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
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);
}
Please check the answer
$questions = Question::where($queryatypes);
$questions = $questions->get();
so your question is your object is not converting into string Right??
because of.. first off all you can use use keyword of top of code like
use App\Question;
and then you write this below code
$questions = Question::where($queryatypes)->get();
or you can not getting then try this
$questions = Question::where($queryatypes);
$questions = $questions->get();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.