| Version | Date | Notes | By |
|---|---|---|---|
| 0.1 | 2017-12-12 | Initial release | ROB |
| 0.2 | 2017-12-12 | Initial role integration | ROB |
OUTDATED!!
During the development of a module you may need to create new resources after the initial set of resources has been created. To do this simply create a new seeder as normal with php artisan seed:make <insert_name_here> and then copy the file to the module's seeds folder.
Then change the extends of the seed class to GardenerResourceSeeder and add the new resources to be added, calling the functions bellow to save them.
You may choose to add the newly created permissions to one or more roles by using the addRolePermission function. Note that the loadInformation function must be called just before adding any role permission (but after adding the resources themselves).
<?php
use WeMake\Sgi\Core\SeederClasses\GardenerResourceSeeder;
/**
* Class T00ResourcesDevelopmentSeeder
*/
class T00ResourcesDevelopmentSeeder extends GardenerResourceSeeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function up()
{
$module = DB::table('t00_modules')->where('slug', '=', 'administration')->first();
$data = [
[
'module_id' => $module->id,
'slug' => 'administration.module',
'model' => null,
'description' => null,
'actions' => ['access'],
'translations' => [
'en' => 'Administration Module',
'pt' => 'Módulo Administração'
]
]
];
$this->insertResources($data);
$this->insertTranslations($data);
$this->insertPermissionActions($data);
$this->insertPermissions($data);
// this portion of the code adds the manage permission of the new resource
// to the global.administrator role
$this->loadInformation();
$this->addRolePermissions('global.administrator', [
'administration.test.manage'
]);
}
}