Support the ongoing development of Laravel.io →
posted 10 years ago
Database
Last updated 2 years ago.
0

So good support :)

Last updated 2 years ago.
0

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.

Last updated 2 years ago.
0

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 :)

Last updated 2 years ago.
0

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 !!

Last updated 2 years ago.
0

I think the problem is from view: resume of this problem : http://laravel.io/forum/05-26-2014-its-a-bug-or-mistake

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.