i'm working on a CRM that should work with multi languages
my users table looks like this:
Users
id
first_name
last_name
email
password
**language_id**
Languages
id
name
short_name //en,fr,ru etc
i'm trying to get the user's language short name when the user is login i tried this:
Auth::user()->language()->short_name; and also this Auth::user()->language->short_name;
and it's not working, i add this to the User model:
public function language()
{
return $this->belongsTo('App\Language');
}
and this part to the Language model:
public function user()
{
return $this->hasMany('App\User');
}
what am i doing wrong?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2ePkOJP
via IFTTT
Aucun commentaire:
Enregistrer un commentaire