Actually it's the same as here I try to achieve
There's no need to override find. Create a custom method. Your current method is just calling itself recursively, which is why you are getting the endless loop.
I'm not sure what you're trying to achieve though. Maybe explain to us why you're trying to do this, and we can help you better. :)
Thanks. Yes, that's what I finally realised and made it like this.
public static function find($key)
{
$obj = Salary::where('id', $key)->limit(1);
if ($obj->count() == 0)
throw new \Exception('No records where found.');
$salary = $obj->first();
if ( $salary->organization != Auth::user()->organization )
throw new \Exception('You do not have permission to this organizatio.');
return $salary;
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community