Given your code, it is obviously that the model can't find a record where it has 'bar' for the 'foo'.
Are you sure you have a record that matches your condition?
Oh and..so good question. You didn't even provide the exception message.
it's an example and don't need exception message and I'm sure the the record exist in database . you can test in you laravel :)
another example
function show($id)
{
$res = SomeModel::someMethod($id);
Log::error(($res)?'true':'false');
if ($res)
{
return View::make('foo');
}
else
{
Log::error(($res)?'true':'false');
}
}
function someMethod($id)
{
return (DB::table('tbl_name')->where('some_id',$id)->count()>0);
}
and with one refresh I see the log [2014-05-26 14:24:47] production.ERROR: true [] [] [2014-05-26 14:24:50] production.ERROR: false [] [] [2014-05-26 14:24:50] production.ERROR: false [] []
it's mean with one referesh request, laravel executes 2 times a method !! the first time my model method returns true and show view , and with other extra requests it returns false !!
I think the problem is from view: resume of this problem : http://laravel.io/forum/05-26-2014-its-a-bug-or-mistake
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community