Reputation: 97
My question is, why does the following not work?
$questions = Question::where($queryatypes);
$questions->get();
I'm getting the following Error:
Object of class Illuminate\Database\Eloquent\Builder could not be converted to string
Upvotes: 2
Views: 5744
Reputation: 4826
Please check the answer
$questions = Question::where($queryatypes);
$questions = $questions->get();
Upvotes: 1
Reputation: 2444
I think you are trying this on your controller and return this Objects directly
use Illuminate\Http\Response;
public function controllerFunction(){
$queryatypes = .....
$questions = Question::where($queryatypes);
$questions->get();
return response($questions);
}
Upvotes: 1