firalabs / firadmin
Basic admin panel for Laravel 4 with login and user controller implementation
Installs: 545
Dependents: 0
Suggesters: 0
Security: 0
Stars: 44
Watchers: 10
Forks: 10
Open Issues: 1
Requires
- php: >=5.3.0
- illuminate/auth: ~4.1
- illuminate/support: ~4.1
- laravelbook/ardent: dev-master
- zendframework/zend-permissions-acl: 2.1.*
Requires (Dev)
- mockery/mockery: dev-master
This package is not auto-updated.
Last update: 2022-02-01 12:23:48 UTC
README
This package is no longer actively maintained. The next version of Laravel 5 should propably contain all basic stuff you need to start a admin panel.
#Firadmin Laravel 4 package used to create a beautiful admin panel with default user managment. This package is currently under active development, following Laravel 4.
##Features
- Resourceful User management with roles permissions
- Base controller use for admin panel development
- ACL component for privilege management
- Complete UI admin panel using Twitter Bootstrap 2.3
- Complete login component with password reset and reminder
- Easily configurable
##Installation
For laravel 4.0 use firadmin version 1.0.* and for laravel 4.1 use firadmin version 1.1.* and above.
Begin by installing this package through Composer. Edit your project's composer.json
file to require firalabs/firadmin
.
{ "require": { "firalabs/firadmin": "dev-master" } }
Update your packages with composer update
or install with composer install
.
Once this operation completes, you need to add the service provider. Open app/config/app.php
, and add a new item to the providers array.
Firalabs\Firadmin\FiradminServiceProvider
Documentation
- Screenshots
- Configurations
- Binding models
- Migrations
- Create default user
- Register dashboard controller
- Facades
- Permissions
- Ajax request
- Admin controller development
- Custom models repositories
##Configurations
To configure the package to meet your needs, you must publish the configuration in your application before you can modify them. Run this artisan command.
php artisan config:publish firalabs/firadmin
The configuration files could now be found in app/config/packages/firalabs/firadmin
. Read the description for each configurations to know what you can override.
##Binding models
You need to bind a user and a user role model to your application. By default, the package already provide those. Add this few lines in app/start/global.php
/* |-------------------------------------------------------------------------- | Application IoC Container binding |-------------------------------------------------------------------------- |*/ App::bind('Firalabs\Firadmin\Repository\UserRepositoryInterface', 'Firalabs\Firadmin\Repository\Eloquent\UserRepository'); //User model App::bind('Firalabs\Firadmin\Repository\UserRoleRepositoryInterface', 'Firalabs\Firadmin\Repository\Eloquent\UserRoleRepository'); //User role model
After that, you must set the same user repository has a model in app/config/auth.php
'model' => 'Firalabs\Firadmin\Repository\Eloquent\UserRepository'
##Migrations
If you use the default models provided in the package, you must run this migration commands.
php artisan auth:reminders
php artisan migrate
php artisan migrate --package="firalabs/firadmin"
##Create default user
You need to have at least one register user in your database. We provided a easy way to create a user using artisan command. Use --role=""administrator""
when setting up a user for the first time.
php artisan create:user [--role[="..."]] username email password
You can also change the role names Firadmin checks on app/config/packages/firalabs/firadmin/config.php
.
'roles' => array( /* * Grant all privileges to the administrator roles. */ 'administrator' => true, /* * Granted basics CRUD privileges to the user administrator role on the user resource. */ 'user_administrator' => array('user' => array('create', 'read', 'update', 'delete')) )
##Register dashboard controller
You must set a route to the dashboard admin panel in app/routes.php
. We provide a default dashboard controller for testing purpose.
/* |-------------------------------------------------------------------------- | Register admin controllers |-------------------------------------------------------------------------- */ Route::group(array ('before' => 'auth', 'prefix' => 'admin' ), function () { Route::get('/', 'Firalabs\Firadmin\Controllers\DashboardController@getIndex'); });
##Facades
We have two available facades:
- Permissions
- AjaxRequest
You can add this facade to your app/config/app.php
file.
array( 'aliases' => array( 'AjaxRequest' => 'Firalabs\Firadmin\Facades\AjaxRequest', 'Permissions' => 'Firalabs\Firadmin\Facades\Permissions' ) );
##Permissions
To handle privileges on the current logged user, simply use this code in your controller action method..
//Check permission if(Permissions::isAllowed(Auth::user(), 'user', 'read') !== true){ return Redirect::route('login') ->with('reason', Lang::get('firadmin::admin.messages.insufficient-permission') . '<br>') ->with('error', 1); }
##Ajax Request Documentation coming soon ...
##Admin controller development
When you want to create a new admin controller, simply extend the BaseController provide in the package. Is a example of a dashboard controller create in the folder app/controllers/Admin/DashboardController.php
<?php use Firalabs\Firadmin\Controllers\BaseController; /** * Default dashboard controller */ class Admin_DashboardController extends BaseController { /** * The current active menu URI * * @var string */ public $active_menu = 'admin'; /** * Get the dashboard */ public function getIndex() { //Set layout content $this->layout->content = View::make('firadmin::dashboard'); } }
##Custom models repositories
You can directly extend those in the packages or simply implement the interfaces provided in Firalabs\Firadmin\Repository
.
##Enjoy !!
You admin panel is now configured. Just go to http://localhost/admin to access the admin panel.
Feel free to contact me !!!