public function run() { DB::table('user_roles')->truncate(); Role::create(['name' => 'Administrator', 'permissions' => ['*']]); Role::create(['name' => 'Utilizator', 'permissions' => []]); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $role = Role::findOrFail($id); $role->delete(); if (Input::has('assign_role')) { $id = Input::get('role_id'); if (Role::find($id)) { User::where('role_id', $role->id)->update(['role_id' => $id]); } } flash("Rolul <b>{$role->name}</b> a fost șters.", 'warning'); return back(); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { return view('admin.users.edit')->withUser(User::findOrFail($id))->withRoles(Role::all()); }