-
Notifications
You must be signed in to change notification settings - Fork 21
Configuration Options
The Watchtower config file (\config\watchtower.php) is meant to give you control over which views to load and provide access to the varying parts of the package. The file itself contains some other miscellaneous options as well.
By editing the dashboard section of the config file you can change what links are presented to your admins. You can add more, change the order, colour and icons, or even remove them altogether. For more customization of the layout, you can also edit the view used for the dashboard. (:scroll: config option : watchtower.views.layout.adminlinks)
By default the three sections that are available in Watchtower are shown with a link to each's index page and using some bootstrap theme-ing. ######Default Appearance
By modifying the order they appear in the array (moving the permissions array from the end to the start of the 'dashboard' array), and changing their colour options (permissions to warning, users to danger and roles to default) we can get an entire different customized display for the dashboard.
'dashboard' => [
'permissions' => [
'name' => "Permissions",
'route' => 'watchtower.permission.index',
'icon' => 'fa fa-5x fa-key',
'colour'=> 'warning'
],
'users' => [
'name' => "Users",
'route' => 'watchtower.user.index',
'icon' => 'fa fa-user fa-5x',
'colour'=> 'danger'
],
'roles' => [
'name' => "Roles",
'route' => 'watchtower.role.index',
'icon' => 'fa fa-users fa-5x',
'colour'=> 'success'
]
]
💡 Tip You can add as many of these dashboard shortcuts as you like just by adding them into the config file. The only caveat is that the 'route' option must be a named route within your application. From a command prompt: php artisan route:list will show you a list of all your routes with their names to make sure your desired one is available.
Site Title This is the text that shows up where you see "Watchtower". If you don't like "Watchtower", you can rename it to whatever suits your needs.
Default Theme Watchtower loads the css for whatever named bootstrap theme from https://www.bootstrapcdn.com/bootswatch/ so you can pick any of the many choices there. Or you can alter the master.layout and load them locally or not at all. Default is for spacelab. (Flatly is also pretty cool for a material look.)
✋ Note There is a View Composer registered within the Watchtower Service Provider that sets both the site title and default theme.
❗ Optional The View Composer also does a check to see if there is a "theme" property under the Auth::user() collection and uses the value from "theme" if one is defined. So if you wish to allow your users the ability to pick their own theme, you can do so. (You would need to add a field to your users table called "theme" and then probably add a theme option to a profile page where they can choose from a list of available themes.)
Pagination By default, Watchtower uses a pagination of "15". You can modify that for users, roles, or permissions by changing the values in this configuration section.
✋ Note Does not apply to matrices.
Watchtower comes ready to go with pre-defined permissions to access all the different areas. Feel free to change them to match your needs, if you wish. The value for each permission can be a permission slug from Shinobi's permission table or a boolean true/false to globally enable/disable permission. However, the permissions in watchtower will return "false" for security if nothing else is supplied in a config file.
✋ Note If you already have defined permissions for accessing the roles & permissions, you are free to change the options under ACL in the watchtower config file to match your environment.
Watchtower permissions are stored under 'acl' and these are what Watchtower checks using Shinobi's can method before any of the admin functions are performed. The following is an example of the Role Index view where the user's permission to view the index page is checked before the list is shown.
@if ( \Shinobi::can( config('watchtower.acl.role.index', false) ) )
The permission "watchtower.acl.role.index" uses the 'show.role.index' slug that is available in the permission table within Shinobi. Note that a default false is applied if the requested permission is not found. This will prevent Watchtower from inadvertently giving access to any functions or views in your admin area. So with this permission in place, the only people that can view your 'role index page' would need to have this permission.
'acl' => [
...
'role' => [
'index' => 'show.role.index',
...
However, if you were to change the "watchtower.acl.role.index" from 'show.role.index' to (bool) true everyone will have the ability to view that page. (not recommended; for illustrative purposes only)
'acl' => [
...
'role' => [
'index' => (bool) true, //or just true (no apostrophes or quotes)
...
Much like the Dashboard Links and Access Control, the views that Watchtower uses can be controlled from the config file. So if you already have your own master layout or view partials that you want to use, simply tell Watchtower where to find them.
For example, if you have a view you already use for your layout that you call in your other views as "app.layout"
and wish to use it as your master layout for Watchtower, you would simply change 'watchtower::layouts.master' to 'app.layout'.
'views' => [
'layouts' => [
'master' => 'app.layout', // 'watchtower::layouts.master',
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.