php - Laravel 5 error Call to undefined method Illuminate\Database\Query\Builder::Test -


i following error while trying retrieve array list use load view create select list.

error: call undefined method illuminate\database\query\builder::albums

in our controller using following:

$albums = \auth::user()->albums->lists('name', 'id'); 

and in model albums.php using:

<?php namespace app\models;  use illuminate\database\eloquent\model;  /**  * app\models\albums  *  */ class albums extends model {     protected $table = 'albums'; } 

in in our main file:

public function albums() {      return $this->hasmany('app\models\albums', 'name', 'id'); } 

the problem \auth::user() object not have albums function

the albums() function must created in user model class


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -