mercredi 4 juillet 2018

join table in larave

I have 3 table in laravel:

class General extends Mode
{
 public function populars()
    {
        return this->hasMany('App\Popular');
    }
}

enter code here

and

class Popular extends Model
{
    public function general()
    {
        return  this->belongsTo('App\General');
    }
}

and

class Specific extends Model
{
public function popular(){
        return this->belongsTo('App\Popular');
    }
}
...

how to join tables and return this list result:

  • generals -- popular --- Specific


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire