laravel use field in Eloquent model from another table -
i have model named "user". want "password" field eloquent table, , when user calls user::all() method, selected fields different tables come in result. how can that?
results not displayed in with() .
my problem solved using $appends in eloquent model .
my code :
class user extends eloquent { protected $table = 'user'; protected $attributes = ['password']; protected $appends = ['password']; public function getpasswordattribute() { return $this->getpasswordmethod(); } }
Comments
Post a Comment