'Posts', 'route' => 'manager.posts.index', 'permission' => 'posts.view'], ['label' => 'Categories and tags', 'route' => 'manager.labels.index', 'permission' => 'posts.labels'], ]; } public function actions(): array { return [ 'posts.store' => ['Created a post'], 'posts.update' => ['Changed a post'], 'posts.online' => ['Put a post on the site, or took it off', ['online']], 'posts.destroy' => ['Deleted a post'], 'labels.store' => ['Made a category or tag', ['type', 'name']], 'labels.update' => ['Renamed a category or tag', ['type', 'name', 'new_name']], 'labels.destroy' => ['Removed a category or tag', ['type', 'name']], ]; } public function views(): array { return [ 'posts.index' => 'Opened the posts', 'posts.create' => 'Opened the form for a new post', 'posts.edit' => 'Opened a post', 'posts.preview' => 'Opened the preview of a post', 'labels.index' => 'Opened the categories and tags', ]; } /** Where the media library looks for the use of a file: the texts of the posts. */ public function boot(): void { app(MediaUsage::class)->register(fn () => Post::query()->get(['body', 'excerpt', 'cover_image'])->flatMap(fn (Post $row) => array_values($row->only(['body', 'excerpt', 'cover_image'])))); } }