|
@@ 96-106 (lines=11) @@
|
| 93 |
|
* @param Requests\DepartmentsValidator $input the input bag from the request. |
| 94 |
|
* @return \Illuminate\Http\Response |
| 95 |
|
*/ |
| 96 |
|
public function store(Requests\DepartmentsValidator $input) |
| 97 |
|
{ |
| 98 |
|
Departments::create($input->all()); |
| 99 |
|
|
| 100 |
|
$output = []; |
| 101 |
|
$output['message'] = 'Department created'; |
| 102 |
|
$output['data'] = $input->all(); |
| 103 |
|
|
| 104 |
|
return response($output, 201) |
| 105 |
|
->header('Content-Type', 'application/json'); |
| 106 |
|
} |
| 107 |
|
|
| 108 |
|
/** |
| 109 |
|
* Update the specified resource in storage. |
|
@@ 118-128 (lines=11) @@
|
| 115 |
|
* @param int $id |
| 116 |
|
* @return \Illuminate\Http\Response |
| 117 |
|
*/ |
| 118 |
|
public function update(Requests\DepartmentsValidator $input, Request $request, $id) |
| 119 |
|
{ |
| 120 |
|
Departments::find($id)->update($input->all()); |
| 121 |
|
|
| 122 |
|
$output = []; |
| 123 |
|
$output['message'] = 'Department updated'; |
| 124 |
|
$output['new_data'] = $input->all(); |
| 125 |
|
|
| 126 |
|
return response($output, 200) |
| 127 |
|
->header('Content-Type', 'application/json'); |
| 128 |
|
} |
| 129 |
|
|
| 130 |
|
/** |
| 131 |
|
* Remove the specified resource from storage. |