10 months ago

How To Query Entire Model For Value

Posted 10 months ago by boldstar

So I am wondering if there is a way to query a model for values but in a way that it checks the entire model instead of a certain column.

For instance if I use

$client = Client::where('first_name', $request->keyword)->with('engagements')->get();

        return response()->json($client);

It will return any record where the first_name column exactly matches the given $keyword

Or if i use

$client = Client::where('first_name', 'LIKE', '%'.$keyword.'%')->get();

Will return clients where the first_name column is like the the given $keyword

But what if I want it to check more than just the first_name column?

Hopefully what I am asking makes sense...

Please sign in or create an account to participate in this conversation.