Laravel
4
Вклад в тег
protected $listen = [
'auth.login' => [
'App\Handlers\Events\AuthLoginEventHandler',
],
];
class Articles extends Model
{
protected $table = 'article';
public function category()
{
return $this->belongsTo('ArticlesCategory', 'id_category', 'id');
}
}
class ArticlesCategory extends Model
{
protected $table = 'article_category';
public function articles()
{
return $this->hasMany('Articles', 'id_category', 'id');
}
}
Articles::with('category')->paginate(25);
$article->category->name