本文整理匯總了PHP中app\Permission::insert方法的典型用法代碼示例。如果您正苦於以下問題:PHP Permission::insert方法的具體用法?PHP Permission::insert怎麽用?PHP Permission::insert使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\Permission
的用法示例。
在下文中一共展示了Permission::insert方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// Inserts the Permissions
Permission::insert($this->permissions);
// Creates a root admin role
$rootadmin = new Role();
$rootadmin->name = "rootadmin";
$rootadmin->display_name = "Root Admin";
$rootadmin->description = "Has Permissions to do everything in the WebPanel";
$rootadmin->save();
//Get all permissions
$ids = Permission::lists('id')->all();
//Sync them to the rootadmin
$rootadmin->perms()->sync($ids);
//Creates an admin user
$admin = new User();
$admin->name = 'admin';
$admin->email = 'admin@admin.com';
$admin->password = bcrypt('password');
$admin->save();
$admin->roles()->sync(array($rootadmin->id));
}
開發者ID:brucewu16899,項目名稱:WebPanel-Core,代碼行數:27,代碼來源:2015_05_20_000000_webpanel_add_permissions_roles.php
示例2: store
public function store(PermissionRequest $request)
{
$dataForms = $request['data'];
if ($dataForms == null) {
return;
}
App\Permission::truncate();
$model = new App\Permission();
foreach ($dataForms as $dataForm) {
$dataSave[] = array('route' => $dataForm);
}
$model->insert($dataSave);
return redirect()->action('Admin\\PermissionController@index')->withSuccess(Lang::get('messages.update_success'));
}