Once you have created and configured multiple CRUD modules in your Twill's admin console, you can configure Twill's dashboard in config/twill.php
.
For each module that you want to enable in a part or all parts of the dashboard, add an entry to the dashboard.modules
array, like in the following example:
1return [ 2 'dashboard' => [ 3 'modules' => [ 4 'projects' => [ // module name if you added a morph map entry for it, otherwise FQN of the model (eg. App\Models\Project) 5 'name' => 'projects', // module name 6 'label' => 'projects', // optional, if the name of your module above does not work as a label 7 'label_singular' => 'project', // optional, if the automated singular version of your name/label above does not work as a label 8 'routePrefix' => 'work', // optional, if the module is living under a specific routes group 9 'count' => true, // show total count with link to index of this module10 'create' => true, // show link in create new dropdown11 'activity' => true, // show activities on this module in activities list12 'draft' => true, // show drafts of this module for current user13 'search' => true, // show results for this module in global search14 ],15 ...16 ],17 ...18 ],19 ...20];
You can also enable a Google Analytics module:
1return [ 2 'dashboard' => [ 3 ..., 4 'analytics' => [ 5 'enabled' => true, 6 'service_account_credentials_json' => storage_path('app/analytics/service-account-credentials.json'), 7 ], 8 ], 9 ...10];
It is using Spatie's Laravel Analytics package.
Follow Spatie's documentation to set up a Google service account and download a json file containing your credentials, and provide your Analytics view ID using the ANALYTICS_PROPERTY_ID
environment variable.
In addition to model activity, you can also enable user login/logout activity.
This feature is disabled by default and can be enabled by setting the following config keys:
1twill.dashboard.auth_activity_log.login => true2twill.dashboard.auth_activity_log.logout => true
File:
config/twill.php
1<?php 2 3return [ 4 'dashboard' => [ 5 'auth_activity_log' => [ 6 'login' => true, 7 'logout' => true 8 ] 9 ]10]