daison/admin-laravel
Composer 安装命令:
composer require daison/admin-laravel
包简介
Ready made admin for your laravel website.
README 文档
README
What I am looking for?
- Developer - who can help me to change, refactor, and to add a feature.
- Translator - you can help by translating the response messages.
- Designer - a designer that can transform the assets into a unique design, instead of using free designs. The credit is yours.
Laravel Admin
I'm still keep on updating this admin package, when you are using the dev-master you will see some sample routes and navigation links, those are my examples to test all the functionality of this package. Each release has a branch and you need to switch for the said branch you used for specific README file.
Anyhow, I'm using this design http://www.blacktie.co/demo/dashgumfree/ as my basis, so try to review the code, later on I'll be importing other admin templates that you can easily configure. Thumbs Up!
Start Up
Include this to your composer, if you want the most updated branch, use dev-master
"require": {
"daison/admin-laravel": "1.2.*"
}
Update your composer ``` composer update ```
Go to /app/config/app.php and add this line ``` 'Daison\AdminLaravel\AdminLaravelServiceProvider', ```
Go to your command line and publish the config, view and assets ``` php artisan config:publish daison/admin-laravel php artisan view:publish daison/admin-laravel php artisan asset:publish daison/admin-laravel --path="vendor/daison/admin-laravel/src/assets" ```
Setup your database and laravel configuration, and run the package migrations ``` php artisan migrate --package="daison/admin-laravel" ```
Or if you have an existing Users table then use publish
php artisan migrate:publish daison/admin-laravel
Pre-Testing
Go to your browser localhost:8080/admin You can now access the admin login page
Go to your command line, and lets create an account to test this admin panel
php artisan tinker
> $user = new User;
> $user->email = "email@gmail.com";
> $user->password = Hash::make('abcd');
> $user->save();
> $role = new Role;
> $role->name = 'superuser';
> $role->save();
> $user_role = new UserHasRole;
> $user_role->user_id = $user->id;
> $user_role->role_id = $role->id;
> $user_role->save();
Go back to the page, and log your recently created account.
Tadda! Now you can see the navigation bar, the site name, and even the logout button, let's move to configuration.
Configuration
Remember we used this command php artisan config:publish daison/admin-laravel Go to /app/config/packages/daison/admin-laravel/ folder you can see these files
- lang
- en.php
- general.php
- navigations.php
- routes.php
####Navigation Lets create our sample navigation,
[name] => [
'name' => 'Navigation Name',
'icon' => 'fa fa-home fa-fv',
'url' => '/admin/sample',
'items'=> [
[name] => [
'name' => 'Second Level Nav Name',
'icon => '',
'url' => '/admin/sample/1',
],
[name] => [
'name' => 'Second Level Nav Name',
'icon => '',
'url' => '/admin/sample/2',
],
],
],
After creating these links with [items], refresh your page and see changes. You can even use 'roles' => ['superuser'] to limit the view access.
####Routes Based from our navigation links, we need to create a route to assign the controller to work with. You can also use the original routes file from /app/config/routes.php, but I suggest to use this approach to separate your original routes from admin routes.
'admin_sample_get' => [
'process' => 'get',
'url' => '/admin/sample/',
'uses' => 'SampleController@showSample',
],
'admin_sample_post' => [
'process' => 'post',
'url' => '/admin/sample/',
'uses' => 'SampleController@saveSample',
],
'admin_sample_rest_get' => [
'process' => 'get',
'url' => '/admin/inventory/{id}/edit',
'uses' => 'InventoryController@showEditItem',
],
'admin_sample_rest_post' => [
'process' => 'post',
'url' => '/admin/inventory/{id}/edit',
'uses' => 'InventoryController@updateItem',
],
Now create your SampleController / InventoryController and it's up to you to handle the responses. You can even assign 'roles' => ['superuser'] to restrict each request, you can also provide 'is_auth' => true to redirect guest to the login page.
####Still using Main Routes
So you still want to use the main app/routes.php, however you want to use the roles management to your routes.
Go to your controller __construct and do the constructor injection.
use Daison\AdminLaravel\AdminLaravel as Admin;
class MyController
{
private $admin;
public function __construct(Admin $admin)
{
$this->admin = $admin;
}
public function showProfile()
{
if ($this->admin->hasAnAccess(['superuser','agent']) == false) {
// It means the Authenticated user doesn't have roles
// Redirect the user, show the access not allowed page... and so on..
}
}
public function saveProfile()
{
// same thing as the showProfile() method.
}
}
I am still updating this README.
daison/admin-laravel 适用场景与选型建议
daison/admin-laravel 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 156 次下载、GitHub Stars 达 8, 最近一次更新时间为 2015 年 02 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「admin」 「php」 「twitter bootstrap」 「laravel」 「administrator」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 daison/admin-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 daison/admin-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 daison/admin-laravel 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Handles basic OAuth/OAuth2 authentication along with classes for common services
Simple Twitter API wrapper
Simple Sharing generates social media share links within CP entry pages, allowing you to quickly & easily share entries.
2lenet/EasyAdminPlusBundle
Analysis module for finding problematical shop data.
A helper module for pdf-print, print and social share functionality based on bootstrap to custom modules.
统计信息
- 总下载量: 156
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-02-02