Installation
- Requirements
- Install With Composer
- Publish Assets And Config
- Administrator Config
- Model Config
- Settings Config
- Update Workflow
Requirements
Laravel Administrator targets Laravel 10 and PHP 8.1 or later. For public deployments, prefer currently supported PHP releases and keep the host Laravel application patched.
The package ships built Vite assets for normal Composer installation. You only need Node.js when you are developing the package assets or building the VitePress documentation site.
Install With Composer
Install the package in your Laravel application:
composer require saaksin/laravel-administratorLaravel package auto-discovery registers the service provider automatically. If auto-discovery is disabled, register it manually:
'providers' => array(
SaAkSin\Administrator\AdministratorServiceProvider::class,
),Publish Assets And Config
Publish the configuration file and package assets:
php artisan vendor:publish --tag=laravel-administrator --forceThis publishes config/administrator.php and the package assets used by the administrator UI. The UI uses Vite-built JavaScript and CSS, Alpine.js, Tailwind CSS, Quill for wysiwyg2, and the bundled CKEditor 4 files for the legacy wysiwyg field.
Administrator Config
The main configuration file is config/administrator.php. At minimum, configure the menu and the directories that contain model and settings configuration files:
return array(
'title' => 'Administrator',
'uri' => 'admin',
'middleware' => array('web', 'auth'),
'model_config_path' => base_path('administrator'),
'settings_config_path' => base_path('administrator/settings'),
'menu' => array(
'users',
'Settings' => array('settings.site'),
),
);Create the configuration directories if they do not exist:
mkdir -p administrator/settingsFor all available options, see the configuration docs.
Model Config
Model configuration files describe Eloquent resources that should appear in the administrator UI. Their file names map to entries in the menu option.
For example, administrator/users.php can describe App\Models\User:
return array(
'title' => 'Users',
'single' => 'user',
'model' => App\Models\User::class,
'columns' => array(
'id',
'name',
'email',
),
'edit_fields' => array(
'name' => array(
'title' => 'Name',
'type' => 'text',
),
'email' => array(
'title' => 'Email',
'type' => 'text',
),
),
);For details, see the model configuration docs.
Settings Config
Settings configuration files manage administrative values that are not best represented by an Eloquent model. Their file names map to settings.* entries in the menu option.
For details, see the settings configuration docs.
Update Workflow
After updating the package, publish the latest assets again:
composer update saaksin/laravel-administrator
php artisan vendor:publish --tag=laravel-administrator --forceIf you automate publishing in the host application's composer.json, keep the command scoped to the package tag:
{
"scripts": {
"post-update-cmd": [
"php artisan vendor:publish --tag=laravel-administrator --force"
]
}
}