'Pages', 'section' => 'Content', 'route' => Names::route('pages.index'), 'permission' => 'pages.edit', 'simple' => true, 'hint' => 'Change the texts and photos of your pages'], ]; } /** The tour: how a page of blocks is built and where the photos come from. Only for a site that has pages of blocks. */ public function tutorial(): array { $blocks = (bool) config('manager.blocks.free_pages') || array_filter(Page::definitions(), fn ($definition) => ! empty($definition['blocks'])) !== []; if (! $blocks) { return []; } return [ ['title' => 'Build a page from parts', 'text' => 'A page is made of parts: a big photo with a title, a text, photos, questions and answers. Open a page, press "Add something to the page", pick a part and fill it in. The arrows move a part up or down.', 'image' => 'pages', 'menu' => 'pages.index', 'permission' => 'pages.layout'], ['title' => 'Photos from your phone', 'text' => 'Wherever you can choose a photo, you can also pick one from your phone or take a new one. It is made smaller by itself, so do not worry about the size. Tip: hold your phone sideways for a wide photo and keep what matters in the middle.', 'image' => 'photos', 'permission' => 'media.upload'], ]; } /** Where the media library looks for the use of a file: the texts of the pages. */ public function views(): array { return ['pages.index' => 'Opened the pages', 'pages.show' => 'Opened a page']; } public function actions(): array { return [ 'pages.store' => ['Created a page'], 'pages.update' => ['Changed a page'], 'pages.destroy' => ['Removed a page'], 'pages.preview' => ['Prepared a preview of a page'], ]; } public function boot(): void { app(MediaUsage::class)->register(fn () => Page::query()->get(['body', 'content'])->flatMap(fn (Page $row) => [$row->body, ...array_values(array_filter((array) $row->content, 'is_string'))])); } }