samedi 29 avril 2017

Laravel 5 SQL Relations

I have some problem with query. I want to filter query by column in server table but I don't know how to do this. Need to modify this line:

$data = $video->files()->with('server')->get();

Model: server

public function files()
{
    return $this->hasMany('App\Models\File', 'id', 'server_id');
}

Model: file

public function server()
{
    return $this->belongsTo('App\Models\Server', 'server_id', 'id')->ordered();
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire