I have two tables. Like this
**
user_accounts usersonglists
-------------- ---------------
id id
username user_account_id
slug etc..
etc..
** I created a route like this
/u/{slug}/songlists
This relation methot in songlist model
public function userAccounts()
{
return $this->belongsTo('App\Models\User\UserAccounts','user_account_id','id');
}
I created controller methot like this
$songLists = $SongListRepository->getSongListsByUserSlug($slug);
This is getSongListByUserSlug($slug) methot
$songList = $this->model->with('userAccounts')->get();
I want to get songlists by user with $slug.
Can someone help me?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire