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');
  }



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1pW5YTw
via IFTTT

Aucun commentaire:

Enregistrer un commentaire