1, ]; //You can specify default eager loaded relationships using the $with property on the model. //https://stackoverflow.com/questions/25674143/laravel-whenever-i-return-a-model-always-return-a-relationship-with-it protected $with = ['owner']; public function __construct(array $attributes = []) { parent::__construct($attributes); $this->table = 'pages'; //config('module.pages.table'); // $this->defaultLocale = 'de'; } public function owner() { return $this->belongsTo(User::class, 'created_by'); } /** * @return string */ public function getActionButtonsAttribute() { return '
' . $this->getEditButtonAttribute('page', 'settings.page.edit') . ' ' . $this->getViewButtonAttribute() . '
'; // '.$this->getDeleteButtonAttribute('page', 'settings.page.destroy').' } /** * @return string */ public function getViewButtonAttribute() { return ' '; } /** * @return string */ public function getStatusLabelAttribute() { if ($this->isActive()) { return "'; } return "'; } /** * @return bool */ public function isActive() { return $this->status == 1; } }