feat: add breadcrumb in admin area

- add Breadcrumb library and service
- update authorizations
- add missing routes to avoid 404 links in breadcrumb
- add svg_helper globally in base controller
- update purgecss config to check .ts files

closes #17
This commit is contained in:
Yassine Doghri 2020-08-05 16:10:39 +00:00
commit 7fb1de2cf3
35 changed files with 397 additions and 82 deletions

View file

@ -12,6 +12,12 @@ class User extends \Myth\Auth\Entities\User
*/
protected $podcasts = [];
/**
* The podcast user is contributing to
* @var \App\Entities\Podcast
*/
protected $podcast;
/**
* Array of field names and the type of value to cast them as
* when they are accessed.
@ -20,6 +26,7 @@ class User extends \Myth\Auth\Entities\User
'active' => 'boolean',
'force_pass_reset' => 'boolean',
'podcast_role' => '?string',
'podcast_id' => '?integer',
];
/**
@ -41,4 +48,19 @@ class User extends \Myth\Auth\Entities\User
return $this->podcasts;
}
public function getPodcast()
{
if (empty($this->podcast_id)) {
throw new \RuntimeException(
'Podcast_id must be set before getting podcast.'
);
}
if (empty($this->podcast)) {
$this->podcast = (new PodcastModel())->find($this->podcast_id);
}
return $this->podcast;
}
}