| 1 | <?php |
||
| 15 | class UserController extends Controller |
||
| 16 | { |
||
| 17 | use Helpers; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Constructor |
||
| 21 | */ |
||
| 22 | public function __construct(Request $request) |
||
|
1 ignored issue
–
show
|
|||
| 23 | { |
||
| 24 | $this->middleware('auth'); |
||
| 25 | } |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Display a listing of the resource. |
||
| 29 | * |
||
| 30 | * @param UserDataTable $dataTable |
||
| 31 | * @return \Illuminate\Http\Response |
||
| 32 | */ |
||
| 33 | public function index(UserDataTable $dataTable) |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Show the form for creating a new resource. |
||
| 43 | * |
||
| 44 | * @return \Illuminate\Http\Response |
||
| 45 | */ |
||
| 46 | public function create() |
||
| 47 | { |
||
| 48 | return view('users.create'); |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Store a newly created resource in storage. |
||
| 53 | * |
||
| 54 | * @param CreateUserRequest $request |
||
| 55 | * @return \Illuminate\Http\Response |
||
| 56 | */ |
||
| 57 | public function store(CreateUserRequest $request) |
||
| 58 | { |
||
| 59 | $user = User::create($request->all()); |
||
| 60 | |||
| 61 | return response()->json(['message' => "User ".$user->username." created."]); |
||
| 62 | } |
||
| 63 | |||
| 64 | /** |
||
| 65 | * Display the specified resource. |
||
| 66 | * |
||
| 67 | * @param int $user_id |
||
| 68 | * @return \Illuminate\Http\Response |
||
| 69 | */ |
||
| 70 | public function show($user_id) |
||
| 71 | { |
||
| 72 | $user = User::with('devices', 'ports')->findOrFail($user_id); |
||
| 73 | return view('users.preferences', ['updated' => false])->withUser($user); |
||
| 74 | // show read only view of user info here |
||
| 75 | } |
||
| 76 | |||
| 77 | /** |
||
| 78 | * Show the form for editing the specified resource. |
||
| 79 | * |
||
| 80 | * @param int $user_id |
||
| 81 | * @return \Illuminate\Http\Response |
||
| 82 | */ |
||
| 83 | public function edit($user_id) |
||
| 91 | |||
| 92 | /** |
||
| 93 | * Update the specified resource in storage. |
||
| 94 | * |
||
| 95 | * @param UpdateUserRequest|Request $request |
||
| 96 | * @param $user_id |
||
| 97 | * @param $type Type of update info|password|adddevice|removedevice|addpor|removeport |
||
| 98 | * @param int $id |
||
| 99 | * @return \Illuminate\Http\Response |
||
| 100 | */ |
||
| 101 | public function update(UpdateUserRequest $request, $user_id) |
||
| 109 | |||
| 110 | /** |
||
| 111 | * Remove the specified resource from storage. |
||
| 112 | * |
||
| 113 | * @param int $user_id |
||
| 114 | * @return \Illuminate\Http\Response |
||
| 115 | */ |
||
| 116 | public function destroy(DeleteUserRequest $request, $user_id) |
||
|
1 ignored issue
–
show
|
|||
| 117 | { |
||
| 118 | $user = User::find($user_id); |
||
| 119 | $user->delete(); |
||
| 120 | |||
| 121 | return response()->json(['message' => "User ".$user->username." deleted."]); |
||
| 122 | } |
||
| 123 | } |
||
| 124 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.