get(); $array = [ 'roles_see', 'roles_edit', 'status_see', 'status_edit', 'project_see', 'project_edit', 'user_see', 'user_edit', 'order_see', 'order_edit' ]; foreach($array as $name) { if($permissions->contains('name', $name)) continue; Permission::create([ 'name' => $name ]); } $role = Role::create([ 'name' => 'administrator', 'readable_name' => 'Administrator', 'color' => '#e74c3c', 'index' => 1 ]); $role->syncPermissions($array); } }