Files
laravel-manager-packagist/config/manager.php
T

218 lines
9.1 KiB
PHP

<?php
use IriksIT\Manager\Modules;
return [
/*
| The URL prefix and the route name prefix of the manager.
*/
'path' => env('MANAGER_PATH', 'manager'),
/*
| Middleware around every manager route. Authentication of the manager itself
| is left to the host app: use the guard it already has.
*/
'middleware' => ['web', 'manager.auth'],
/*
| The screens. `package`: the manager brings its own (a Vue app, built, served by the package; it also gives a login and
| a profile when the app has none). `none`: only the JSON API, for an app that builds its own screens.
*/
'ui' => env('MANAGER_UI', 'package'),
/*
| The name in the menu and on the login screen.
*/
'name' => env('MANAGER_NAME'),
/*
| Looks. `theme` is what everyone gets until they choose; `user_themes` lets each account pick its own (profile).
| A theme is a set of colours, a radius and fonts: built in are `dark` and `light`; the site's own live as JSON files in
| `themes_path` (make one with `php artisan manager:make-theme`) or here in `themes`, by key.
*/
'theme' => env('MANAGER_THEME', 'dark'),
'user_themes' => (bool) env('MANAGER_USER_THEMES', true),
'themes_path' => null, // default: resources/manager-themes of the app
'themes' => [],
/*
| The Eloquent model of the people who log in. Must use IriksIT\Manager\Concerns\HasManagerAccess.
*/
'user_model' => env('MANAGER_USER_MODEL', 'App\\Models\\User'),
/*
| The modules this manager knows. Add your own class here to give a site its own part.
*/
'available' => [
Modules\Users\UsersModule::class,
Modules\Media\MediaModule::class,
Modules\Pages\PagesModule::class,
Modules\Posts\PostsModule::class,
Modules\Reviews\ReviewsModule::class,
Modules\Audit\AuditModule::class,
Modules\Statistics\StatisticsModule::class,
Modules\Resources\ResourcesModule::class,
],
/*
| Switch a part on or off per site. A key left out falls back to the default of the
| module: users and media are on, everything else is off. A module that is off has no
| routes, no tables (its migrations are not loaded), no menu item and no permissions.
*/
'modules' => [
'users' => true,
'media' => true,
'pages' => env('MANAGER_PAGES', true),
'posts' => env('MANAGER_POSTS', true),
'reviews' => env('MANAGER_REVIEWS', false),
'audit' => env('MANAGER_AUDIT', false),
'statistics' => env('MANAGER_STATISTICS', false),
'resources' => true,
],
/*
| The media library. Files live on a Laravel filesystem disk; each media row remembers
| its own disk, so a file stays where it was uploaded when `disk` changes later.
*/
'media' => [
'disk' => env('MANAGER_MEDIA_DISK', 'public'),
// How much room the library has in total, in GB. An upload that would go over it is refused.
'max_total_gb' => (float) env('MANAGER_MEDIA_MAX_TOTAL_GB', 15),
// Largest single upload in MB. PHP and the web server must allow it too
// (upload_max_filesize, post_max_size, client_max_body_size).
'max_file_mb' => (int) env('MANAGER_MEDIA_MAX_FILE_MB', 40),
// File extensions the library accepts. SVG is deliberately missing: it can carry scripts.
'extensions' => ['jpg', 'jpeg', 'png', 'webp', 'gif', 'pdf', 'mp4', 'webm'],
// Visitors loading files per minute per address (the `media-files` rate limiter).
'per_minute' => 600,
],
/*
| Posts. `categories` are always offered in the post form, next to the ones in use and the
| ones made by hand; a site can offer more through PostLabels::suggestCategories().
*/
'posts' => [
'categories' => ['General'],
],
/*
| Markdown in posts: hosts besides APP_URL whose links do not open in a new window.
*/
'markdown' => [
'internal_hosts' => [],
],
/*
| The audit log and the bans (module `audit`).
*/
'audit' => [
// Addresses that are never banned, by hand or by themselves: your own, so a slip or a rule
// that is too strict never locks you out. Comma-separated in MANAGER_NEVER_BAN.
'never_ban' => array_values(array_filter(array_map('trim', explode(',', (string) env('MANAGER_NEVER_BAN', ''))))),
// The longest the log may be kept, in days. Set it to what your privacy policy promises.
'max_keep_days' => (int) env('MANAGER_AUDIT_MAX_KEEP_DAYS', 90),
// Let a ban "for the whole site" work: the middleware then runs on every request of the app.
'whole_site_bans' => (bool) env('MANAGER_AUDIT_WHOLE_SITE_BANS', false),
],
/*
| The visitor statistics (module `statistics`).
*/
'statistics' => [
// The addresses of the public site that count as a page. Anything else is ignored, so
// nobody can fill the statistics with made-up addresses. Posts and other kinds of pages
// come from `posts_path` or a resolver: app(CountedPages::class)->register(fn ($path) => ...).
'pages' => ['/'],
// The address under which the posts live (`/blog` for `/blog/my-post`); null: posts are not counted.
'posts_path' => null,
// Where the public pages report a view (POST {pulse_path}/view and {pulse_path}/leave).
'pulse_path' => 'pulse',
// Reports per minute per address.
'per_minute' => 120,
// The request header with the country code of the visitor, e.g. CF-IPCountry behind Cloudflare. Null: no country.
'country_header' => env('MANAGER_STATISTICS_COUNTRY_HEADER'),
// Count the pages served to programs (search engines, crawlers) by adding a middleware to the `web` group.
'count_bots' => (bool) env('MANAGER_STATISTICS_COUNT_BOTS', true),
],
/*
| Pages with fields (module `pages`): per slug a title and the fields the screens make a form of, and the
| public site reads with `IriksIT\Manager\Models\Page::contentFor('home')`:
| 'definitions' => ['home' => ['title' => 'Home', 'fields' => [
| 'hero_title' => ['label' => 'Title on the photo', 'type' => 'text'],
| 'intro' => ['label' => 'Story', 'type' => 'markdown'],
| 'photo' => ['label' => 'Photo', 'type' => 'media'],
| ]]].
| Types: text, textarea, markdown, lines, media, url, number, date, toggle, select (with `options`).
*/
'pages' => ['definitions' => []],
/*
| Lists the site manages without code of its own: a form, a list, permissions (`<key>.view`, `<key>.manage`)
| and a menu item for each. `model` keeps the records in a model of the site (the field keys are its
| attributes); without it they go into the package's own table. Fields: see `pages`.
| 'services' => ['label' => 'Services', 'singular' => 'Service', 'model' => App\Models\Service::class,
| 'columns' => ['name', 'price'], 'order' => ['position', 'asc'], 'fields' => ['name' => ['type' => 'text', 'required' => true], ...]]
*/
'resources' => [],
/*
| A bundle of the site's own screens: JavaScript modules (a path of the site, or https) the manager loads next to its own,
| after it has started. They add screens with `IriksManager.register('^/leads$', Component, { data: true })`, and may
| `import { ref } from 'vue'` when the build leaves `vue` external. See README, "Your own screens".
*/
'extensions' => [],
/*
| The menu. `items` changes what a module gives, by the route name without the prefix:
| 'posts.index' => ['order' => 10, 'section' => 'Content', 'icon' => 'file', 'simple' => true, 'hidden' => false].
| `links` adds items of the site's own: ['label' => 'Leads', 'url' => '/manager/leads', 'permission' => null,
| 'section' => ..., 'icon' => ..., 'order' => ..., 'simple' => ..., 'new_tab' => ...].
| Icons: home, file, image, users, group, chart, shield, star, tag, link, cog.
*/
'menu' => ['items' => [], 'links' => []],
/*
| A simple face of the manager next to the full one. With this on, the permissions `manager.full` and
| `manager.switch` exist: an account with the first (or a super admin) gets everything; one with the
| second starts simple and may switch; all others always get the simple face, which shows only the
| menu items marked `simple`. Off: everyone sees the whole menu.
*/
'simple_view' => (bool) env('MANAGER_SIMPLE_VIEW', false),
/*
| Prefix for the tables of the package.
*/
'table_prefix' => 'manager_',
/*
| A table with a name of its own, by short name (`posts`, `pages`, `media`, ...): wins over the prefix.
| Set it before the first migrate; the package never renames a table that exists.
*/
'tables' => [],
/*
| Prefix of the route names (`manager.posts.index`). Change it when the site already has `manager.*`
| routes; menu items and screens follow by themselves.
*/
'route_name' => 'manager',
/*
| Where `php artisan manager:import <posts|pages|reviews>` reads from, so it needs no options:
| 'posts' => ['table' => 'articles', 'connection' => null, 'map' => ['title' => 'headline']].
*/
'import' => [],
];