dimanche 3 avril 2016

get column list with Eloquent relation in laravel

I want to get column list with Eloquent relation in laravel. When I use this comman

 $columns = Schema::getColumnListing('news');

Result is all fields of news table but I want to get relation fields for CategoryNews table.

News model:

public function NewsCategories()
   {
    return $this->belongsTo('App\CategoryNews');
   }

CategoryNews model:

public function News()
  {
    return $this->hasMany('App\News');
  }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire