Configuration Options - SmarchSoftware/amazo GitHub Wiki

The Amazo config file (\config\amazo.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.


Miscellaneous

Layout Amazo assumes you already have a master layout. Specify it here so that view partials that Amazo 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. Amazo 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 Amazo 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' => 'Amazo Damage Types',

Pagination By default, Amazo uses a pagination of "15". You can modify that by changing the value in this configuration section.

'pagination' => '15',

Access Control

Amazo 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.

Amazo uses my OMAC trait which, currently, allows for 4 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.
  • Entrust - if you are using the popular Caffeinated\Entrust 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, Amazo 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 : Amazo 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 Amazo'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 resources.
 | 'show' is to view individual resources.
 | 'edit' is to change existing resources.
 | 'destroy' is to delete existing resources.
 | 'destroy_mod' is to delete a modifier
 | 'add_mod' is to add a modifier
 |
 */  
   'acl' => [
    'enable'    => false,
    'driver'    => 'laravel',
    'index'     => 'amazo.index',            
    'create'    => 'amazo.create',
    'show'      => 'amazo.show',
    'edit'      => 'amazo.edit',
    'destroy'   => 'amazo.destroy',
    'destroy_mod' => 'amazo.destroy.mod',
    'add_mod'   => 'amazo.add.mod'
],

Views

Much like the Access Control, the views that Amazo uses can be controlled from the config file. So if you already have your own view partials that you want to use, simply tell Amazo where to find them.

For example, if you have a view for unauthorized users to see, you would simply change 'views => unauthorized' from 'amazo::unauthorized' to your preferred view.

/*
|--------------------------------------------------------------------------
| Views
|--------------------------------------------------------------------------
|
| Amazo 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'         => 'amazo::index',            
    'create'        => 'amazo::create',
    'show'          => 'amazo::edit',
    'edit'          => 'amazo::edit',
    'unauthorized'  => 'amazo::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.


Routes

If you have any custom route prefixs or group names you wish to use, or you wish to change out "amazo" as your route name(s), you can use this part of the config file to accomplish that.

/*
|--------------------------------------------------------------------------
| Route Options
|--------------------------------------------------------------------------
| Prefix :
|-------------------------
|
| If you want to prefix all your Amazo 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/amazo/create' instead of
| 'http://<yoursite>/amazo/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 "amazo" in your named routes
| you can specify it here.
|
*/
'route' => [
    'prefix'    => '',
    'as'        => 'amazo.',
    'middleware'=> (str_contains( app()->version(), '5.2') ? ['web'] : ['auth'])
],

NOTE By default the "middleware" option contains the necessary middlewares dependent on your version of laravel. If you wish to add other Middleware(s), please be sure to add to the existing array and not remove the ones provided. Laravel 5.2 requires ALL routes that use sessions to be a part of the "web" middleware.

⚠️ **GitHub.com Fallback** ⚠️