本文整理汇总了PHP中Permission::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Permission::create方法的具体用法?PHP Permission::create怎么用?PHP Permission::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Permission
的用法示例。
在下文中一共展示了Permission::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
Permission::create([]);
}
}
示例2: run
public function run()
{
$faker = Faker::create();
Permission::truncate();
DB::table('permission_role')->truncate();
Permission::create(['action' => 'User.create']);
Permission::create(['action' => 'User.view']);
Permission::create(['action' => 'User.update']);
Permission::create(['action' => 'User.delete']);
Permission::create(['action' => 'Category.create']);
Permission::create(['action' => 'Category.view']);
Permission::create(['action' => 'Category.update']);
Permission::create(['action' => 'Category.delete']);
Permission::create(['action' => 'Post.create']);
Permission::create(['action' => 'Post.view']);
Permission::create(['action' => 'Post.update']);
Permission::create(['action' => 'Post.delete']);
Permission::create(['action' => 'Comment.create']);
Permission::create(['action' => 'Comment.view']);
Permission::create(['action' => 'Comment.update']);
Permission::create(['action' => 'Comment.delete']);
Permission::create(['action' => 'Role.create']);
Permission::create(['action' => 'Role.view']);
Permission::create(['action' => 'Role.update']);
Permission::create(['action' => 'Role.delete']);
Permission::create(['action' => 'Permission.create']);
Permission::create(['action' => 'Permission.view']);
Permission::create(['action' => 'Permission.update']);
Permission::create(['action' => 'Permission.delete']);
$admin = Role::find(1);
$admin->permissions()->sync(range(1, 24));
}
示例3: run
public function run()
{
DB::table('permissions')->delete();
Permission::create(array('ime' => Permission::PERMISSION_VIEW_UCIONICA, 'opis' => 'Dozvola za pregledavanje popisa učionica i svake pojedine učionice. Ne uključuje dodavanje novih učionica, niti uređivanje ni brisanje postojećih.'))->save();
Permission::create(array('ime' => Permission::PERMISSION_VIEW_KLIJENT, 'opis' => 'Dozvola za pregledavanje popisa klijenata i svakog pojedinog klijenta. Ne uključuje dodavanje novih klijenata, niti uređivanje ni brisanje postojećih.'))->save();
Permission::create(array('ime' => Permission::PERMISSION_VIEW_PREDMET_KATEGORIJA, 'opis' => 'Dozvola za pregledavanje strukture kategorija i predmeta i svakog pojedinog predmeta. Ne uključuje dodavanje novih predmeta ili kategorija, niti uređivanje ni brisanje postojećih.'))->save();
Permission::create(array('ime' => Permission::PERMISSION_VIEW_ROLE, 'opis' => 'Dozvola za pregledavanje popisa uloga i svake pojedine uloge. Ne uključuje dodavanje novih uloga, niti uređivanje ni brisanje postojećih.'))->save();
Permission::create(array('ime' => Permission::PERMISSION_VIEW_USER, 'opis' => 'Dozvola za pregledavanje popisa djelatnika i svakog pojedinog djelatnika. Ne uključuje dodavanje novih djelatnika, niti uređivanje ni brisanje postojećih.'))->save();
Permission::create(array('ime' => Permission::PERMISSION_MANAGE_UCIONICA, 'opis' => 'Dozvola za dodavanje novih učionica i uređivanje postojećih. Uklonjanje učionica nije uključeno u ovu dozvolu. Zahtjeva ' . Permission::PERMISSION_VIEW_UCIONICA . '.'))->save();
Permission::create(array('ime' => Permission::PERMISSION_MANAGE_KLIJENT, 'opis' => 'Dozvola za pregledanje, dodavanje novih i uređivanje postojećih klijenata. Uklonjanje klijenata nije uključeno u ovu dozvolu. Zahtjeva ' . Permission::PERMISSION_VIEW_KLIJENT . '.'))->save();
Permission::create(array('ime' => Permission::PERMISSION_MANAGE_PREDMET_KATEGORIJA, 'opis' => 'Dozvola za pregledanje, dodavanje novih i uređivanje postojećih kategorija i predmeta. Uključuje dodjeljivanje/oduzimanje predmeta pojedinom djelatniku. Uklonjanje kategorija i predmeta nije uključeno u ovu dozvolu. Zahtjeva ' . Permission::PERMISSION_VIEW_PREDMET_KATEGORIJA . '.'))->save();
Permission::create(array('ime' => Permission::PERMISSION_MANAGE_ROLE, 'opis' => 'Dozvola za pregledanje, dodavanje novih i uređivanje postojećih uloga. Uključuje određivanje dozvola pojedine uloge (tako i svojoj vlastitoj ulozi). Uklonjanje uloga nije uključeno u ovu dozvolu. Zahtjeva ' . Permission::PERMISSION_VIEW_ROLE . '.'))->save();
Permission::create(array('ime' => Permission::PERMISSION_MANAGE_USER, 'opis' => 'Dozvola za dodavanje novih djelatnika i uređivanje postojećih. Također uključuje dozvolu za promjenom uloge bilo kojem djelatniku (pa i sebi samome). Uklonjanje djelatnika nije uključeno u ovu dozvolu. Zahtjeva ' . Permission::PERMISSION_VIEW_USER . '.'))->save();
Permission::create(array('ime' => Permission::PERMISSION_REMOVE_UCIONICA, 'opis' => 'Dozvola za uklonjanje učionica. Zahtjeva ' . Permission::PERMISSION_MANAGE_UCIONICA . '.'))->save();
Permission::create(array('ime' => Permission::PERMISSION_REMOVE_PREDMET_KATEGORIJA, 'opis' => 'Dozvola za uklonjanje predmeta i čitavih kategorija. Zahtjeva ' . Permission::PERMISSION_MANAGE_PREDMET_KATEGORIJA . '.'))->save();
Permission::create(array('ime' => Permission::PERMISSION_REMOVE_ROLE, 'opis' => 'Dozvola za uklonjanje uloga. Zahtjeva ' . Permission::PERMISSION_MANAGE_ROLE . '.'))->save();
Permission::create(array('ime' => Permission::PERMISSION_REMOVE_USER, 'opis' => 'Dozvola za uklonjanje djelatnika. Zahtjeva ' . Permission::PERMISSION_MANAGE_USER . '.'))->save();
Permission::create(array('ime' => Permission::PERMISSION_PASSWORD_RESET, 'opis' => 'Dozvola za promjenom lozinke drugom djelatniku. Zahtjeva ' . Permission::PERMISSION_MANAGE_USER . '.'))->save();
Permission::create(array('ime' => Permission::PERMISSION_OWN_REZERVACIJA_HANDLING, 'opis' => 'Dozvola za rezerviranje u vlastito ime i uređivanje postojeće vlastite rezervacije, prije njenog početka. Ujedno dozvola za naplaćivanje osobne rezervacije nakon odrade. Dozvola za dodavanje novog klijenta ukoliko se ne pojavljuje u sustavu.'))->save();
Permission::create(array('ime' => Permission::PERMISSION_TECAJ, 'opis' => 'Dodaje mogućnost da se rezervacije ovog instruktora označe kao tečajevi. Zahtjeva ' . Permission::PERMISSION_OWN_REZERVACIJA_HANDLING . '.'))->save();
Permission::create(array('ime' => Permission::PERMISSION_FOREIGN_REZERVACIJA_HANDLING, 'opis' => 'Dozvola za rezerviranje u ime druge osobe i uređivanje postojeće tuđe rezervacije, prije njenog početka. Ujedno dozvola za naplaćivanje tuđe rezervacije nakon odrade. Dozvola za dodavanje novog klijenta ukoliko se ne pojavljuje u sustavu.'))->save();
Permission::create(array('ime' => Permission::PERMISSION_EDIT_STARTED_REZERVACIJA, 'opis' => 'Dozvola za uređivanje rezervacije, nakon njenog početka, bilo osobne ili tuđe. Dozvola za dodavanje novog klijenta ukoliko se ne pojavljuje u sustavu.'))->save();
Permission::create(array('ime' => Permission::PERMISSION_REMOVE_STARTED_REZERVACIJA, 'opis' => 'Dozvola za uklonjanje započete rezervacije sa njenom naplatom, bilo osobne ili tuđe.'))->save();
Permission::create(array('ime' => Permission::PERMISSION_REMOVE_NALATA, 'opis' => 'Dozvola za uklonjanje naplate, bilo osobne ili tuđe.'))->save();
Permission::create(array('ime' => Permission::PERMISSION_SEE_GLOBAL_IZVJESTAJ, 'opis' => 'Dozvola za gledanje ukupnog izvještaja, bilo tjednog ili mjesečnog.'))->save();
Permission::create(array('ime' => Permission::PERMISSION_SEE_FOREIGN_IZVJESTAJ, 'opis' => 'Dozvola za gledanje izvještaja drugog djelatnika, bilo tjednog ili mjesečnog. Zahtjeva ' . Permission::PERMISSION_MANAGE_USER . '.'))->save();
Permission::create(array('ime' => Permission::PERMISSION_DOWNLOAD_DATA, 'opis' => 'Dozvola za preuzimanje pohranjenih podataka u sustavu u obliku Excel tablica.'))->save();
}
示例4: run
public function run()
{
/**
* Truncate Tables
*/
Permission::truncate();
Role::truncate();
User::truncate();
DB::table('assigned_roles')->truncate();
DB::table('permission_role')->truncate();
/**
* Seed Datas
*/
$permissions = [['name' => 'Role:list', 'display_name' => 'List Roles', 'group_name' => 'Role'], ['name' => 'Role:show', 'display_name' => 'Show Role', 'group_name' => 'Role'], ['name' => 'Role:create', 'display_name' => 'Create New Role', 'group_name' => 'Role'], ['name' => 'Role:edit', 'display_name' => 'Edit Existing Role', 'group_name' => 'Role'], ['name' => 'Role:delete', 'display_name' => 'Delete Existing Role', 'group_name' => 'Role'], ['name' => 'Permission:list', 'display_name' => 'List Permissions', 'group_name' => 'Permission'], ['name' => 'Permission:show', 'display_name' => 'Show Permission', 'group_name' => 'Permission'], ['name' => 'Permission:create', 'display_name' => 'Create New Permission', 'group_name' => 'Permission'], ['name' => 'Permission:edit', 'display_name' => 'Edit Existing Permission', 'group_name' => 'Permission'], ['name' => 'Permission:delete', 'display_name' => 'Delete Existing Permission', 'group_name' => 'Permission'], ['name' => 'User:list', 'display_name' => 'List Users', 'group_name' => 'Users'], ['name' => 'User:show', 'display_name' => 'Show User', 'group_name' => 'Users'], ['name' => 'User:create', 'display_name' => 'Create New User', 'group_name' => 'Users'], ['name' => 'User:edit', 'display_name' => 'Edit Existing User', 'group_name' => 'Users'], ['name' => 'User:delete', 'display_name' => 'Delete Existing User', 'group_name' => 'Users'], ['name' => 'User:set_confirmation', 'display_name' => 'Set Existing User\'s Confirmed Status', 'group_name' => 'Users'], ['name' => 'User:set_password', 'display_name' => 'Set Existing User\'s Password', 'group_name' => 'Users']];
$roles = [['name' => 'Admin'], ['name' => 'Role Admin'], ['name' => 'Permission Admin'], ['name' => 'User Admin'], ['name' => 'User'], ['name' => 'Upload Admin']];
$users = [['first_name' => 'System', 'last_name' => 'Administrator', 'username' => 'admin', 'email' => 'admin@example.com', 'password' => 'admin', 'password_confirmation' => 'admin', 'confirmed' => 1], ['first_name' => 'System', 'last_name' => 'User', 'username' => 'user', 'email' => 'user@example.com', 'password' => 'user', 'password_confirmation' => 'user', 'confirmed' => 1]];
$user_roles = [1 => [1], 2 => [6]];
/**
* Insert Into DB
*/
foreach ($permissions as $data) {
Permission::create($data);
}
foreach ($roles as $data) {
Role::create($data);
}
foreach ($users as $data) {
$user = User::create($data);
if (isset($user_roles[$user->id])) {
$user->roles()->sync($user_roles[$user->id]);
}
}
}
示例5: run
public function run()
{
//$faker = Faker::create();
$permissions = ['read' => 'Read'];
foreach ($permissions as $permission_name => $display_name) {
Permission::create(['name' => $permission_name, 'display_name' => $display_name]);
}
}
示例6: store
/**
* Store a newly created resource in storage.
* POST /permissions
*
* @return Response
*/
public function store()
{
$permission = Permission::create(Input::all());
if ($permission) {
return $this->respond($permission);
}
return $this->respondServerError();
}
示例7: store
/**
* Store a newly created permission in storage.
*
* @return Response
*/
public function store()
{
$validator = Validator::make($data = Input::all(), Permission::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
Permission::create($data);
return Redirect::route('permissions.index');
}
示例8: run
public function run()
{
$permissions = array('Manage Users', 'Manage Roles', 'Manage Permissions', 'Manage Openings', 'Manage Settings');
foreach ($permissions as $permission) {
Permission::create(['name' => $permission, 'slug' => $permission, 'description' => $permission]);
}
$permissions = Permission::lists('id');
Role::find(1)->permissions()->attach($permissions);
}
示例9: create
public function create($name)
{
// TODO: Implement create() method.
$permission = $this->getPermission($name);
if (!$permission) {
return Permission::create(['name' => $name]);
} else {
return $permission;
}
}
示例10: run
public function run()
{
//Seed for role
$ccc = Role::create(array('name' => "CCC Worker", 'description' => "CCC Section Workers"));
//Seed for permission
$cccperm = Permission::create(array("name" => "can_access_ccc_reports", "display_name" => "Can access CCC reports"));
//Assign all ccc permission to role ccc
DB::table('permission_role')->insert(array('permission_id' => $cccperm->id, 'role_id' => $ccc->id));
$this->command->info("CCC role/permission seeded");
}
示例11: run
public function run()
{
//removes existing permissions from table
DB::table('permissions')->delete();
Permission::create(['name' => 'access_admin_routes', 'description' => 'User can access Admin routes']);
Permission::create(['name' => 'access_member_routes', 'description' => 'User can access Member routes']);
Permission::create(['name' => 'create_resource', 'description' => 'Create resource that belongs to the User']);
Permission::create(['name' => 'view_resource', 'description' => 'View resource that belongs to the User']);
Permission::create(['name' => 'edit_resource', 'description' => 'Edit resource that belongs to the User']);
Permission::create(['name' => 'update_resource', 'description' => 'Update resource that belongs to the User']);
Permission::create(['name' => 'delete_resource', 'description' => 'Delete resource that belongs to the User']);
}
示例12: requireDefaultRecords
/**
* Add permissions from config.permissions if they don't exist. If they do exist will not update.
*/
public function requireDefaultRecords()
{
foreach (self::config()->permissions as $code => $fields) {
$permission = Permission::get()->filter(['Code' => $code])->first();
if (!$permission) {
$permission = Permission::create(array_merge($fields, ['Code' => $code]));
$permission->write();
DB::alteration_message("Added permission '{$code}'", 'changed');
} else {
DB::alteration_message("Unchanged permission '{$code}'", 'unchanged');
}
}
}
示例13: run
public function run()
{
DB::table('roles')->delete();
DB::table('permissions')->delete();
$roles = ['Administrator', 'Users Manager', 'Eraser', 'Premium Author', 'Author', 'Premium User', 'User', 'Guest'];
foreach ($roles as $role) {
Role::create(['name' => $role]);
}
$perms = ['Manage Users', 'Manage Series', 'Manage Premium Casts', 'Manage Free Casts', 'Delete Users', 'Delete Series', 'Delete Casts', 'View Premium Casts', 'View Free Casts'];
foreach ($perms as $perm) {
Permission::create(['display_name' => $perm, 'name' => str_replace(' ', '_', strtolower($perm))]);
}
}
示例14: run
public function run()
{
DB::table('permissions')->truncate();
$permissions = array(array('name' => 'adm', 'display_name' => 'Admin'), array('name' => 'usr', 'display_name' => 'User'));
foreach ($permissions as $permission) {
Permission::create($permission);
}
// DB::table('permissions')->insert( $permissions );
DB::table('permission_role')->truncate();
$user = Role::where('name', '=', 'User')->first()->id;
$admin = Role::where('name', '=', 'Admin')->first()->id;
$permission_role = array(array('role_id' => $user, 'permission_id' => $user), array('role_id' => $admin, 'permission_id' => $admin));
DB::table('permission_role')->insert($permission_role);
}
示例15: run
public function run()
{
Eloquent::unguard();
/* Users table */
$usersData = array(array("username" => "administrator", "password" => Hash::make("password"), "email" => "admin@kblis.org", "name" => "kBLIS Administrator", "designation" => "Administrator"), array("username" => "external", "password" => Hash::make("password"), "email" => "admin@kblis.org", "name" => "External System User", "designation" => "Administrator", "image" => "/i/users/user-2.jpg"));
foreach ($usersData as $user) {
$users[] = User::create($user);
}
$this->command->info('users seeded');
/* Measure Types */
$measureTypes = array(array("id" => "1", "name" => "Numeric Range"), array("id" => "2", "name" => "Alphanumeric Values"), array("id" => "3", "name" => "Autocomplete"), array("id" => "4", "name" => "Free Text"));
foreach ($measureTypes as $measureType) {
MeasureType::create($measureType);
}
$this->command->info('measure_types seeded');
/* Test Phase table */
$test_phases = array(array("id" => "1", "name" => "Pre-Analytical"), array("id" => "2", "name" => "Analytical"), array("id" => "3", "name" => "Post-Analytical"));
foreach ($test_phases as $test_phase) {
TestPhase::create($test_phase);
}
$this->command->info('test_phases seeded');
/* Test Status table */
$test_statuses = array(array("id" => "1", "name" => "not-received", "test_phase_id" => "1"), array("id" => "2", "name" => "pending", "test_phase_id" => "1"), array("id" => "3", "name" => "started", "test_phase_id" => "2"), array("id" => "4", "name" => "completed", "test_phase_id" => "3"), array("id" => "5", "name" => "verified", "test_phase_id" => "3"));
foreach ($test_statuses as $test_status) {
TestStatus::create($test_status);
}
$this->command->info('test_statuses seeded');
/* Specimen Status table */
$specimen_statuses = array(array("id" => "1", "name" => "specimen-not-collected"), array("id" => "2", "name" => "specimen-accepted"), array("id" => "3", "name" => "specimen-rejected"));
foreach ($specimen_statuses as $specimen_status) {
SpecimenStatus::create($specimen_status);
}
$this->command->info('specimen_statuses seeded');
/* Permissions table */
$permissions = array(array("name" => "view_names", "display_name" => "Can view patient names"), array("name" => "manage_patients", "display_name" => "Can add patients"), array("name" => "receive_external_test", "display_name" => "Can receive test requests"), array("name" => "request_test", "display_name" => "Can request new test"), array("name" => "accept_test_specimen", "display_name" => "Can accept test specimen"), array("name" => "reject_test_specimen", "display_name" => "Can reject test specimen"), array("name" => "change_test_specimen", "display_name" => "Can change test specimen"), array("name" => "start_test", "display_name" => "Can start tests"), array("name" => "enter_test_results", "display_name" => "Can enter tests results"), array("name" => "edit_test_results", "display_name" => "Can edit test results"), array("name" => "verify_test_results", "display_name" => "Can verify test results"), array("name" => "send_results_to_external_system", "display_name" => "Can send test results to external systems"), array("name" => "refer_specimens", "display_name" => "Can refer specimens"), array("name" => "manage_users", "display_name" => "Can manage users"), array("name" => "manage_test_catalog", "display_name" => "Can manage test catalog"), array("name" => "manage_lab_configurations", "display_name" => "Can manage lab configurations"), array("name" => "view_reports", "display_name" => "Can view reports"));
foreach ($permissions as $permission) {
Permission::create($permission);
}
$this->command->info('Permissions table seeded');
/* Roles table */
$roles = array(array("name" => "Superadmin"), array("name" => "Technologist"), array("name" => "Receptionist"));
foreach ($roles as $role) {
Role::create($role);
}
$this->command->info('Roles table seeded');
}