Hi guys I am new in Laravel I want your help. Here is my database:
user: id, name, surname, email, role
user_informations: id, user_id, status
I want the name of all users where status is enable.
What I do is this:
User.php
public function information()
{
return $this->hasOne('App\UserInformation');
}
UserInformation.php
public function guider()
{
return $this->belongsTo('App\User');
}
This is my query:
$users =User::where('role', '2')->information()->get();
Call to undefined method Illuminate\Database\Eloquent\Builder::information()
I know my query is wrong, because i ahve not defined anywhere that i want to get all users that have their status 'enable'