Level 102
You can specify columns in firstOrFail
https://laravel.com/api/5.8/Illuminate/Database/Eloquent/Builder.html#method_firstOrFail
Hello, is there a way to use first or fail and also get only some columns?
I have a table which have a lot of columns, so, excluding all of those tables is likely not an option. I was using this:
return $this->where([$filter => $identifier, 'Password' => $password])->get(['project_id', 'first_name']);
and it works fine, but I want it to throw the not found exception if doesn't find anything in the db
You can specify columns in firstOrFail
https://laravel.com/api/5.8/Illuminate/Database/Eloquent/Builder.html#method_firstOrFail
Please or to participate in this conversation.