1
|
|
|
<?php namespace App\Http\Controllers; |
2
|
|
|
|
3
|
|
|
use App\Training_Resource; |
4
|
|
|
use Illuminate\Support\Facades\Input; |
5
|
|
|
use Request; |
6
|
|
|
|
7
|
|
|
class Training_Resource_Controller extends Controller |
8
|
|
|
{ |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Display a listing of the resource. |
12
|
|
|
* |
13
|
|
|
* @return Response |
14
|
|
|
*/ |
15
|
|
|
public function index() |
16
|
|
|
{ |
17
|
|
|
$training_resources = new Training_Resource; |
18
|
|
|
|
19
|
|
|
$id = Input::get('training_resource_parentResourceId'); |
20
|
|
|
|
21
|
|
|
if ($id || ($id == 0)) |
22
|
|
|
$training_resources = $training_resources::where('training_resource_parentResourceId', '=', $id); |
23
|
|
|
|
24
|
|
|
return $training_resources->get(); |
25
|
|
|
|
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Show the form for creating a new resource. |
30
|
|
|
* |
31
|
|
|
* @return Response |
32
|
|
|
*/ |
33
|
|
|
public function create() |
34
|
|
|
{ |
35
|
|
|
// |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Store a newly created resource in storage. |
40
|
|
|
* |
41
|
|
|
* @return Response |
42
|
|
|
*/ |
43
|
|
|
public function store() |
44
|
|
|
{ |
45
|
|
|
|
46
|
|
|
$training_resource = Training_Resource::create(Request::all()); |
47
|
|
|
return $training_resource; |
48
|
|
|
|
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Display the specified resource. |
53
|
|
|
* |
54
|
|
|
* @param int $id |
55
|
|
|
* @return Response |
56
|
|
|
*/ |
57
|
|
|
public function show($id) |
58
|
|
|
{ |
59
|
|
|
|
60
|
|
|
$training_resource = Training_Resource::find($id); |
61
|
|
|
return $training_resource; |
62
|
|
|
|
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Show the form for editing the specified resource. |
67
|
|
|
* |
68
|
|
|
* @param int $id |
69
|
|
|
* @return Response |
70
|
|
|
*/ |
71
|
|
|
public function edit($id) |
|
|
|
|
72
|
|
|
{ |
73
|
|
|
// |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Update the specified resource in storage. |
78
|
|
|
* |
79
|
|
|
* @param int $id |
80
|
|
|
* @return Response |
81
|
|
|
*/ |
82
|
|
|
public function update($id) |
83
|
|
|
{ |
84
|
|
|
$training_resource = Training_Resource::find($id); |
85
|
|
|
$training_resource->training_resource_name = Request::input('training_resource_name'); |
86
|
|
|
$training_resource->training_resource_short_name = Request::input('training_resource_short_name'); |
87
|
|
|
$training_resource->training_resource_description = Request::input('training_resource_description'); |
88
|
|
|
$training_resource->training_resource_thumbnail = Request::input('training_resource_thumbnail'); |
89
|
|
|
$training_resource->training_resource_external_url = Request::input('training_resource_external_url'); |
90
|
|
|
$training_resource->training_resource_softDeleted = Request::input('training_resource_softDeleted'); |
91
|
|
|
|
92
|
|
|
$training_resource->save(); |
93
|
|
|
|
94
|
|
|
return $training_resource; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* Remove the specified resource from storage. |
99
|
|
|
* |
100
|
|
|
* @param int $id |
101
|
|
|
* @return Response |
102
|
|
|
*/ |
103
|
|
|
public function destroy($id) |
104
|
|
|
{ |
105
|
|
|
Training_Resource::destroy($id); |
106
|
|
|
} |
107
|
|
|
} |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.