Giter Club home page Giter Club logo

admin's Introduction

##Simple Administrator Package for Laravel 4.*

###Installation

  1. Open your composer.json file and and new required package:
"pingpong/admin": "dev-master"
  1. Open terminal and run:
composer update
  1. After composer updated, add new service provider:
'Pingpong\Admin\AdminServiceProvider',
  1. Open your terminal and run this following code:
php artisan admin:setup

It will be running come artisan for setup Administrator Automatically.

  1. For test run php artisan serve and open http://localhost:8000/admin your browser. By default username and password is admin.

###Artisan CLI This package have 3 artisan command: 1. 2. For generate restful auth. This will help you creation login page for administrator.

php artisan admin:generate-auth  

For example, if you will be create a new named 'Auth' you can run :

php artisan admin:generate-auth Auth

it will be created File AuthController on your controllers folder. 3. For generate config file. This will help you restful resources login page for administrator.

php artisan admin:generate-config  

For example:

php artisan admin:generate-config users --table=users --eloquent=User

That will be create new file in app/config/packages/pingpong/admin/resources/ folder named users

###Understanding configuration file for admin page

  1. Title Page

/* |---------------------------------------------------- | Title |---------------------------------------------------- | Here is title in admin page. You can use your brand | name. | */ 'title' => 'Administrator',

2. Footer and Copyright

/* |---------------------------------------------------- | Copyright |---------------------------------------------------- | Here is copyright. You can use Closure object or a | string | */ 'copyright' => function() { return '© '. date('Y').' All rights reserved.'; },

3. Home Page

/* |---------------------------------------------------- | Homepage |---------------------------------------------------- | Here you define what view are you show in homepage. | */ 'homepage' => [ 'view' => 'admin::homepage', 'data' => [] ],


4. Login Url

/* |---------------------------------------------------- | Login url |---------------------------------------------------- | Routes url for login page | */ 'login-url' => 'admin-login',


5. Menu and Submenu

/* |---------------------------------------------------- | Menus |---------------------------------------------------- | Here you define all menus for your admin page. | */ 'menus' => [ 'home' => [ 'title' => 'Home', 'url' => 'admin' ], 'data' => [ 'title' => 'Data', 'url' => '#' ], ],

/* |---------------------------------------------------- | Sub menus |---------------------------------------------------- | Here you define sub menu for main menu above. | */ 'submenus' => [ 'data' => [ [ 'title' => 'Users', 'url' => 'admin/users' ] ], ],


6. Permission and filters

/* |---------------------------------------------------- | Permission |---------------------------------------------------- | What permission are you use for secure admin page ? | */ 'permission' => 'admin.auth',

/*
|----------------------------------------------------
| Costum filters
|----------------------------------------------------
| Here code to register your costum filters
|
*/
'filters'	=>	[
	'admin.auth'	=>	function()
	{
		if( ! Auth::check())
		{
			return Redirect::to(Config::get('admin::admin.login-url'))
			  ->with('message-error', 'You must logged in first.')
			;
		}
	}
],

7. Costum Pages

/* |---------------------------------------------------- | Costum page |---------------------------------------------------- | Here code to register your costum page | */ 'pages' => array( 'logout' => function() { if(Auth::check()) { Auth::logout(); return Redirect::to('/') ->with('message-success', 'Logout success.') ; }

		return Redirect::to('/')
			->with('message-error', 'You are not logged in.')
		;
	}
),

8. Resources

/* |---------------------------------------------------- | Resources |---------------------------------------------------- | Here code to register your resources | */ 'resources' => array( 'users', ),


9. Admin Template

/* |---------------------------------------------------- | Template |---------------------------------------------------- | Here you define what view template are you use for | admin page. | */ 'template' => 'admin::template',


###Understanding configuration file for resources 
By default if you creating new config file you will get many array config like below:

'users', 'eloquent' => 'User', 'data-perpage' => 10, 'title' => array( 'index' => 'All Users Data (%s)', 'create' => 'Add New', 'edit' => 'Edit Data', 'show' => 'Show Data', 'search' => 'Search Result : "%s"' ), 'search' => 'id', 'fields' => array( 'show' => '*', 'format' => array( // // example // // 'fullname' => 'Fullname', // 'user_id' => ['Username', function($value) // { // return User::find($value)->username; // }], ) ), 'validation' => array( 'create' => array( 'rules' => array(), 'messages' => array(), 'format' => array(), ), 'update' => array( 'rules' => array(), 'messages' => array(), 'format' => array() ) ), 'form' => array( 'create' => array( // // example // // 'username' => array( // 'title' => 'Username', // 'field' => array( // 'type' => 'text', // 'value' => null, // 'attributes' => array( // 'class' => 'form-control' // ) // ) // ) ), 'update' => 'auto' ), ); ``` ###License This package is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

admin's People

Contributors

gravitano avatar johnnye avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.