本文整理汇总了PHP中app\models\Permission::truncate方法的典型用法代码示例。如果您正苦于以下问题:PHP Permission::truncate方法的具体用法?PHP Permission::truncate怎么用?PHP Permission::truncate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Permission
的用法示例。
在下文中一共展示了Permission::truncate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::statement('SET FOREIGN_KEY_CHECKS=0');
User::truncate();
Role::truncate();
Permission::truncate();
DB::statement('SET FOREIGN_KEY_CHECKS=1');
Model::unguard();
$this->call(UserTableSeeder::class);
$this->call(RolesTableSeeder::class);
$this->call(PermissionsTableSeeder::class);
Model::reguard();
}
示例2: run
public function run()
{
Permission::truncate();
Permission::create(['name' => 'login-web', 'permission' => 'Login to Web', 'description' => 'Allow user to log in via web.', 'is_default' => 1, 'is_readonly' => 1]);
Permission::create(['name' => 'login-api', 'permission' => 'Login via API', 'description' => 'Allow user to log in via API.', 'is_default' => 0, 'is_readonly' => 1]);
Permission::create(['name' => 'edit-profile-web', 'permission' => 'Edit Profile via web', 'description' => 'Allow user to edit profile via web.', 'is_default' => 0, 'is_readonly' => 1]);
Permission::create(['name' => 'edit-profile-api', 'permission' => 'Edit Profile via API', 'description' => 'Allow user to edit profile via API.', 'is_default' => 0, 'is_readonly' => 1]);
Permission::create(['name' => 'system-info', 'permission' => 'View System Information', 'description' => 'View system information.', 'is_default' => 0, 'is_readonly' => 1]);
Permission::create(['name' => 'user-list', 'permission' => 'List Users', 'description' => 'List users.', 'is_default' => 0, 'is_readonly' => 1]);
Permission::create(['name' => 'user-info', 'permission' => 'View User Info', 'description' => 'View user information.', 'is_default' => 0, 'is_readonly' => 1]);
Permission::create(['name' => 'user-add', 'permission' => 'Add User', 'description' => 'Add user.', 'is_default' => 0, 'is_readonly' => 1]);
Permission::create(['name' => 'user-edit', 'permission' => 'Edit User', 'description' => 'Edit user.', 'is_default' => 0, 'is_readonly' => 1]);
Permission::create(['name' => 'user-delete', 'permission' => 'Delete User', 'description' => 'Delete user.', 'is_default' => 0, 'is_readonly' => 1]);
Permission::create(['name' => 'role-list', 'permission' => 'List Roles', 'description' => 'List roles.', 'is_default' => 0, 'is_readonly' => 1]);
Permission::create(['name' => 'role-info', 'permission' => 'View Role Info', 'description' => 'View role information.', 'is_default' => 0, 'is_readonly' => 1]);
Permission::create(['name' => 'role-add', 'permission' => 'Add Role', 'description' => 'Add role.', 'is_default' => 0, 'is_readonly' => 1]);
Permission::create(['name' => 'role-edit', 'permission' => 'Edit Role', 'description' => 'Edit role.', 'is_default' => 0, 'is_readonly' => 1]);
Permission::create(['name' => 'role-delete', 'permission' => 'Delete Role', 'description' => 'Delete role.', 'is_default' => 0, 'is_readonly' => 1]);
Permission::create(['name' => 'permission-list', 'permission' => 'List Permissions', 'description' => 'List permissions.', 'is_default' => 0, 'is_readonly' => 1]);
Permission::create(['name' => 'permission-info', 'permission' => 'View Permission Info', 'description' => 'View permission information.', 'is_default' => 0, 'is_readonly' => 1]);
Permission::create(['name' => 'permission-add', 'permission' => 'Add Permission', 'description' => 'Add permission.', 'is_default' => 0, 'is_readonly' => 1]);
Permission::create(['name' => 'permission-edit', 'permission' => 'Edit Permission', 'description' => 'Edit permission.', 'is_default' => 0, 'is_readonly' => 1]);
Permission::create(['name' => 'permission-delete', 'permission' => 'Delete Permission', 'description' => 'Delete permission.', 'is_default' => 0, 'is_readonly' => 1]);
}
示例3: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Permission::truncate();
$permissions = ["view_lecturer", "create_lecturer", "edit_lecturer", "delete_lecturer", "view_student", "create_student", "edit_student", "delete_student", "edit_profile", "view_profile", "view_user", "create_user", "edit_user", "delete_user", "view_university", "create_university", "edit_university", "delete_university", "view_sos_request", "create_sos_request", "edit_sos_request", "delete_sos_request"];
$names = ["View Lecturer", "Create Lecturer", "Edit Lecturer", "Delete Lecturer", "View Student", "Create Student", "Edit Student", "Delete Student", "Edit Profile", "View Profile", "View User", "Create User", "Edit User", "Delete User", "View University", "Create University", "Edit University", "Delete University", "View SOS Request", "Create SOS Request", "Edit SOS Request", "Delete SOS Request"];
for ($i = 0; $i < count($permissions); $i++) {
$r = Permission::create(['name' => $names[$i], 'permission' => $permissions[$i]]);
}
}