Package Data | |
---|---|
Maintainer Username: | ronaldoooo |
Maintainer Contact: | zosong@126.com (zsong) |
Package Create Date: | 2017-07-06 |
Package Last Update: | 2017-07-06 |
Home Page: | http://120.26.143.106/admin |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-10-25 03:00:41 |
Package Statistics | |
---|---|
Total Downloads: | 5 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 2 |
Total Forks: | 0 |
Total Open Issues: | 1 |
laravel-admin
is administrative interface builder for laravel which can help you build CRUD backends just with few lines of code.
Demo use username/password:admin/admin
Inspired by SleepingOwlAdmin and rapyd-laravel.
First, install laravel, and make sure that the database connection settings are correct.
Laravel 5.2
composer require encore/laravel-admin "dev-master"
Laravel 5.3
composer require encore/laravel-admin "1.3.x-dev"
Laravel 5.1
composer require encore/laravel-admin "1.1.x-dev"
Inconfig/app.php
addServiceProvider
:
Encore\Admin\Providers\AdminServiceProvider::class
Then run these commands to finnish install:
php artisan vendor:publish --tag=laravel-admin
php artisan admin:install
open http://localhost/admin/
in browser,use username admin
and password admin
to login.
The file in config/admin.php
contains an array of settings, you can find the default settings in there.
After install,you can find directoryapp/Admin
,and then most of our develop work is under this directory.
app/Admin
├── Controllers
│ ├── ExampleController.php
│ └── HomeController.php
└── routes.php
app/Admin/routes.php
is used to define routes,for more detail please read routes.
The app/Admin/Controllers
directory is used to store all the controllers, The HomeController.php
file under this directory is used to handle home request of admin,The ExampleController.php
file is a controller example.
We use users
table come with Laravel
for example,the structure of table is:
CREATE TABLE `users` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
UNIQUE KEY `users_email_unique` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
And the model for this table is App\User.php
You can follow these steps to setup CURD
interfaces of table users
:
Use the following command to create a controller for App\User
model
php artisan admin:make UserController --model=App\\User
The above command will create the controller in app/Admin/Controllers/UserController.php
.
Add a route in app/Admin/routes.php
:
$router->resource('users', UserController::class);
Open http://localhost:8000/admin/auth/menu
, add menu link and refresh the page, then you can find a link item in left menu bar.
The rest needs to be done is open app/Admin/Contollers/UserController.php
, find form()
and grid()
method and write few lines of code with model-grid
and model-form
,for more detail, please read model-grid and model-form.
laravel-admin
based on thses plugins or services:
laravel-admin
is licensed under The MIT License (MIT).