/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id) { $role = Role::findOrFail($id); $formData = \Request::only(['description', 'title', 'email_public', 'email_private', 'slack_channel']); $this->roleValidator->validate($formData); $role->update($formData); return \Redirect::back(); }
/** * Remove the specified resource from storage. * * @param $roleId * @param $userId * @return Response */ public function destroy($roleId, $userId) { $role = Role::findOrFail($roleId); //don't let people remove the admin permission if they are a trustee $user = User::findOrFail($userId); if ($user->active && $user->director && $role->name == 'admin') { \Notification::error("You cannot remove a trustee from the admin group"); return \Redirect::back(); } $role->users()->detach($userId); return \Redirect::back(); }
/** * Reverse the migrations. * * @return void */ public function down() { Role::where('name', 'membership')->delete(); Role::where('name', 'comms')->delete(); Role::where('name', 'metalworking')->delete(); Role::where('name', 'woodworking')->delete(); Role::where('name', 'safety')->delete(); Role::where('name', 'trustees')->delete(); Schema::table('roles', function (Blueprint $table) { $table->dropColumn('description'); }); }
public function financeMemberCanVisitPaymentPage(FunctionalTester $I) { $I->am('a member of the finance group'); $I->wantTo('make sure I can view the payments page'); //Load and login a known member $user = User::find(3); $role = Role::findByName('finance'); $role->users()->attach($user->id); Auth::login($user); $I->amOnPage('/payments'); $I->seeCurrentUrlEquals('/payments'); $I->see('Payments'); }
/** * Execute the console command. * * @return mixed */ public function handle() { foreach ($this->acsNodeRepository->getAll() as $device) { $this->info('Checking device ' . $device->name); /** @var $device \BB\Entities\ACSNode */ if ($device->heartbeatWarning()) { $this->warn('Heartbeat warning'); //There is a warning with the device, see if people have been notified $notificationHash = $device->device_id . md5($device->last_heartbeat->timestamp); $message = 'Nothing has been heard from device "' . $device->name . '"" in a while. '; $message .= 'The last update was ' . \Carbon\Carbon::now()->diffForHumans($device->last_heartbeat, true) . ' ago.'; $role = Role::findByName('acs'); foreach ($role->users()->get() as $user) { $this->info(' Notifying ' . $user->name); Notification::logNew($user->id, $message, 'device_contact', $notificationHash); } } } }
/** * Show the form for editing the specified resource. * * @param string $equipmentId * @return Response */ public function edit($equipmentId) { $equipment = $this->equipmentRepository->findBySlug($equipmentId); $memberList = $this->userRepository->getAllAsDropdown(); $roleList = \BB\Entities\Role::lists('title', 'id'); //$roleList->prepend(null); //dd($roleList); return \View::make('equipment.edit')->with('equipment', $equipment)->with('memberList', $memberList)->with('roleList', $roleList->toArray())->with('ppeList', $this->ppeList); }
/** * Reverse the migrations. * * @return void */ public function down() { Role::where('name', 'equipment')->delete(); }
/** * Reverse the migrations. * * @return void */ public function down() { Role::where('name', 'finance')->delete(); }
/** * Reverse the migrations. * * @return void */ public function down() { Role::where('name', 'infra')->delete(); Role::findByName('acs')->update(['name' => 'infra', 'title' => 'Infrastructure', 'description' => 'Access control systems and all things RFID']); }
/** * Reverse the migrations. * * @return void */ public function down() { Role::where('name', '3dprinting')->delete(); }
/** * Reverse the migrations. * * @return void */ public function down() { Role::where('name', 'storage')->delete(); }
/** * Reverse the migrations. * * @return void */ public function down() { Role::where('name', 'infra')->delete(); Role::where('name', 'laser')->delete(); }
/** * Reverse the migrations. * * @return void */ public function down() { Role::where('name', 'admin')->delete(); }
/** * Display a specific group * * @param string $roleName * * @return Response */ public function show($roleName) { $role = Role::with('Users')->where('name', $roleName)->first(); return View::make('groups.show')->with('role', $role); }