-
Notifications
You must be signed in to change notification settings - Fork 0
Configuration Options
The Lex config file (\config\lex.php) is meant to give you control over which views to load and provide access to the varying parts of this package. The file itself contains some other miscellaneous options as well.
Layout Lex assumes you already have a master layout. Specify it here so that view partials that Lex uses for forms will know how to theme your app. A default is provided that is pretty common.
'layout' => 'layouts.app',
Section In your master layout, this is the name of the section that your master layout uses. Lex will use this name for it's sectional content.
i.e. if you use yield('content') in your master layout for the position where you want Lex to appear then the section is called "content".
'section' => 'content',
Title This is the text that shows up on the header of the index page.
'title' => 'Lex Currency',
Pagination By default, Lex uses a pagination of "15". You can modify that by changing the value in this configuration section.
'pagination' => '15',
Lex comes ready to go with pre-defined permissions to access all the different areas. By default it is disabled, but once you are ready to use authorization in your app, you can switch it to enabled by changing the value of "enable" from false to true.
Currently, there are 3 types of authorization driver options to choose from, pick the appropriate one for your usage needs :
-
Laravel (default)
- if you are using laravel's default "Auth" / "Gate" methods, choose "laravel" as your driver.
-
Sentinel
- if you are using the popular Cartalyst\Sentinel package, choose "sentinel" as your driver.
- Shinobi - if you are using the popular Caffeinated\Shinobi package, choose "shinobi" as your driver.
The next five acl options (index, create, show, edit, destory) will related to your permissions in your app. Some sensible defaults are provided but feel free to change these however you see fit.
/*
|-------------------------------------------------------------------------
| Authorization ?
|-------------------------------------------------------------------------
|
| Out of the box, Lex can optionally use Laravel's built in authorization
| methods. If you wish to make use of them, switch the enable param
| to true and then use the permissions that your app requires.
|
| Note : Lex itself does not provide authorization and when/if you
| decide to enable the ACL options, the Auth::user() methods "can"
| "can" and "cannot" must already have those permissions defined.
| Installing/enabling authorization is outside Lex's scope.
|
| ACL overview :
| 'enable' true/false
| 'driver' [ "laravel" or "shinobi" or "sentinel" ]
| 'index' is to view the index page.
| 'create' is to create new currencies.
| 'show' is to view individual currencies.
| 'edit' is to change existing currencies.
| 'destroy' is to delete existing currencies.
| 'cume_view' is to view cumulative totals.
| 'cume_edit' is to update cumulative totals.
|
*/
'acl' => [
'enable' => false,
'driver' => 'laravel',
'index' => 'lex.index',
'create' => 'lex.create',
'show' => 'lex.show',
'edit' => 'lex.edit',
'destroy' => 'lex.destroy' ,
'cume_view' => 'lex.cumulative.view',
'cume_edit' => 'lex.cumulative.edit'
],
Much like the Access Control, the views that Lex uses can be controlled from the config file. So if you already have your own view partials that you want to use, simply tell Lex where to find them.
For example, if you have a view for unauthorized users to see, you would simply change 'views => unauthorized' from 'lex::unauthorized' to your preferred view.
/*
|--------------------------------------------------------------------------
| Views
|--------------------------------------------------------------------------
|
| Lex comes pre-equipped with views that will work right out of the box.
| However, you are free to define you own views to use here instead.
|
*/
'views' => [
'index' => 'lex::index',
'create' => 'lex::create',
'show' => 'lex::edit',
'edit' => 'lex::edit',
'unauthorized' => 'lex::unauthorized'
],
If you don't have anything created yet or are happy with the ones provided you don't need to make any changes to this section.
This is where you can set your route options for the routes that come with the Lex package
/*
|--------------------------------------------------------------------------
| Route Options
|--------------------------------------------------------------------------
| Prefix :
|-------------------------
|
| If you want to prefix all your lex routes, enter the prefix here.
| https://laravel.com/docs/5.2/routing#route-group-prefixes for info.
|
| i.e 'route_prefix' => 'admin' will change your urls to look
| like 'http://<yoursite>/admin/lex/create' instead of
| 'http://<yoursite>/lex/create'. Default is none.
|
|-------------------------
| Middleware :
|-------------------------
| An array of middlewares you wish to pass in to the group. Laravel 5.2
| by default requires that the "web" middleware be use for any routes
| that need access to session (or 'logged in' won't stay that way.)
|
| Laravel 5.1 uses "auth" for authentication so that gets passed.
|
|-------------------------
| As :
|-------------------------
| If you want to use something other than "lex" in your named routes
| you can specify it here.
|
*/
'route' => [
'prefix' => '',
'as' => 'lex.',
'middleware'=> (str_contains( app()->version(), '5.2') ? ['web'] : ['auth'])
],
/*
|--------------------------------------------------------------------------
| Implementation options
|--------------------------------------------------------------------------
|
| By default, lex will use your users table as its relationship. If you
| have a different table / key / pivot-field-name you want to use,
| specify it here. If you decide to change tables AFTER you have
| run the migrations you will need to delete the table and run
| the migration again. Or manually alter the pivot table.
|
*/
'characters' => [
'table' => 'users',
'key' => 'id',
'pivot' => 'user_id'
]
✋ NOTE: If you decide, after running the migrations, that you would rather use a "characters" table and a "character_id" pivot, you will need to either
Delete the existing character_currency table and remove the reference from the migrations table and then run the migrations again OR
Manually alter the character_currency table to reflect the changes in your characters section of the config.