Skip to content

Query remembers it state. #1525

Open
Open
@Siebov

Description

@Siebov
$query = $this->proposal->where('status', 'approved')
            ->with(['evaluations', 'user', 'contributions'])
            ->with(['reviews' => function ($q) {
                $q->where('status','approved')->orderBy('created_at', 'desc');
            }]);

...

dd($query->toSql()); // "select * from "proposals" where "status" = ?"

$proposalsFoundByTile = $query->where('title','like',"%$request->search%")->get();

dd($query->toSql()); // "select  from "proposals" where "status" = ? and "title" like ?"

...

Why $query value changed? How can I "clear" this changes to initial value?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs investigationNeed investigation about bugs described in issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions