0
down vote
favorite
First Blade View - Works fine
{{Auth::user()->firstName}} {{Auth::user()->getAdminAccount()->level}}
Then I call to controller, there also dd(Auth::user()->getAdminAccount()->level) works fine
After that I redirect to same page, then I get Error
Maximum function nesting level of '100' reached, aborting!
13 C:\wamp\www\PayPanel\PayPanel\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Builder.php(207): Illuminate\Database\Eloquent\Builder->get()
14 C:\wamp\www\PayPanel\PayPanel\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Builder.php(220): Illuminate\Database\Eloquent\Builder->first()
15 C:\wamp\www\PayPanel\PayPanel\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Relations\Relation.php(344): Illuminate\Database\Eloquent\Builder->firstOrFail()
16 C:\wamp\www\PayPanel\PayPanel\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Relations\Relation.php(344): call_user_func_array:{C:\wamp\www\PayPanel\PayPanel\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Relations\Relation.php:344}()
17 C:\wamp\www\PayPanel\PayPanel\app\User.php(50): Illuminate\Database\Eloquent\Relations\Relation->__call()
18 C:\wamp\www\PayPanel\PayPanel\app\User.php(50): Illuminate\Database\Eloquent\Relations\HasMany->firstOrFail()
19 C:\wamp\www\PayPanel\PayPanel\storage\framework\views\13e1e8769f3412635d77f8349fdd960f4b7381b8.php(278): App\User->getAdminAccount()
My function in user Model public function commission() { return $this->hasMany('App\Commission', 'userId', 'id'); }
public function getAdminAccount() { return $this->commission()->where('level','A')->firstOrFail(); }
Increase the value of xdebug.max_nesting_level in your php.ini:
xdebug.max_nesting_level = 1000
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community