/**
  * Store a newly created Role in storage.
  *
  * @param CreateRoleRequest $request
  *
  * @return Response
  */
 public function store(CreateRoleRequest $request)
 {
     $input = $request->all();
     $input['objectId'] = str_random(10);
     $role = $this->roleRepository->create($input);
     Flash::success('Role saved successfully.');
     return redirect(route('roles.index'));
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(CreateRoleRequest $request)
 {
     $new = new Role();
     $new->name = $request->input('name');
     $new->event_id = $request->input('event_id');
     $new->cost = $request->input('cost');
     $new->save();
     return redirect('admin/role');
 }
Exemple #3
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(CreateRoleRequest $request)
 {
     $created = $this->role->create($request->all());
     if ($created) {
         return redirect()->route('create_role')->with('message', 'Role successfuly registered!');
     } else {
         return redirect()->route('create_role')->with('error-message', 'Failed to Add role');
     }
 }
Exemple #4
0
 /**
  * Store a newly created Role in storage.
  *
  * @param CreateRoleRequest $request
  *
  * @return Response
  */
 public function store(CreateRoleRequest $request)
 {
     $this->authorize('system.manage');
     $input = $request->all();
     $role = $this->roleRepository->create($input);
     $role->abilities()->sync($input['abilities']);
     Flash::success('Role saved successfully.');
     return redirect(route('roles.index'));
 }
 /**
  * Store a newly created Role in storage.
  * @param CreateRoleRequest $request
  * @return Response
  */
 public function store(CreateRoleRequest $request)
 {
     $role = $this->roleRepository->create(['name' => $request->input('name'), 'slug' => $request->input('slug')]);
     $roleLocal = Sentinel::findRoleById($role->id);
     $perms = $request->input('permissions');
     foreach ($perms as $perm) {
         $roleLocal->addPermission($perm);
     }
     $roleLocal->save();
     Flash::success('Role saved successfully.');
     return redirect(route('roles.index'));
 }
Exemple #6
0
 public function store(\App\Http\Requests\CreateRoleRequest $request)
 {
     // create new record of role
     $role = $this->role->store($request->get('name'));
     // check if any permission is provided
     // if it is, get all this permission and attach to the newly created role
     if ($request->get('actions')) {
         // get all permission ids
         $permissions = $this->getPermissionIds($this->permission->getPermissionByResourceAndAction($request->get('actions')));
         // sync this permission ids with the role
         $role->permissions()->sync($permissions);
     }
     // flash successfull message
     $request->session()->flash('success', 'Successfully create role. You may add more if you wish.');
     // return back to previous
     return back();
 }
 /**
  * Update the specified Role in storage.
  *
  * @param  int    $id
  * @param CreateRoleRequest $request
  *
  * @return Response
  */
 public function update($id, CreateRoleRequest $request)
 {
     /** @var Role $role */
     $role = Role::find($id);
     if (empty($role)) {
         Flash::error('Role not found');
         return redirect(route('admin.roles.index'));
     }
     $role->fill($request->all());
     $this->syncPermissions($role, $request->input('permissions'));
     $role->save();
     Flash::message('Role updated successfully.');
     return redirect(route('admin.roles.index'));
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  App\Http\Requests\CreateRoleRequest  $request
  * @return \Illuminate\Http\Response
  */
 public function store(CreateRoleRequest $request)
 {
     $this->authorize('roles-create');
     Role::create($request->all());
     return redirect('roles');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param Requests\CreateRoleRequest $request
  * @return Response
  */
 public function store(Requests\CreateRoleRequest $request)
 {
     $input = $request->all();
     $result = $this->role->store($input);
     return redirect('roles');
 }
 public function store(CreateRoleRequest $request)
 {
     $groupType = Role::create($request->all());
     return redirect()->route('roles.index')->with('successes', ['Role created successfully']);
 }
Exemple #11
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id, Requests\CreateRoleRequest $request)
 {
     //
     $role = \App\Role::findOrFail($id);
     $input = $request->all();
     \Session::flash('flash_message', 'role ' . $role->name . ' updated.');
     // update
     $role->update($input);
     return redirect('roles/' . $role->id);
 }