1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Huntie\JsonApi\Http\Controllers; |
4
|
|
|
|
5
|
|
|
use Illuminate\Http\Request; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Add default resource controller methods for JsonApiController actions. |
9
|
|
|
* |
10
|
|
|
* @method indexAction() |
11
|
|
|
* @method storeAction() |
12
|
|
|
* @method showAction() |
13
|
|
|
* @method updateAction() |
14
|
|
|
* @method destroyAction() |
15
|
|
|
*/ |
16
|
|
|
trait JsonApiControllerActions |
17
|
|
|
{ |
18
|
|
|
/** |
19
|
|
|
* Return a listing of the resource. |
20
|
|
|
* |
21
|
|
|
* @param Request $request |
22
|
|
|
* |
23
|
|
|
* @return \Huntie\JsonApi\Http\JsonApiResponse |
24
|
|
|
*/ |
25
|
|
|
public function index(Request $request) |
26
|
|
|
{ |
27
|
|
|
return parent::indexAction($request); |
|
|
|
|
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Store a new record. |
32
|
|
|
* |
33
|
|
|
* @param Request $request |
34
|
|
|
* |
35
|
|
|
* @return \Huntie\JsonApi\Http\JsonApiResponse |
36
|
|
|
*/ |
37
|
|
|
public function store(Request $request) |
38
|
|
|
{ |
39
|
|
|
return parent::storeAction($request); |
|
|
|
|
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Return a specified record. |
44
|
|
|
* |
45
|
|
|
* @param Request $request |
46
|
|
|
* @param int $id |
47
|
|
|
* |
48
|
|
|
* @return \Huntie\JsonApi\Http\JsonApiResponse |
49
|
|
|
*/ |
50
|
|
|
public function show(Request $request, $id) |
51
|
|
|
{ |
52
|
|
|
return parent::showAction($request, $id); |
|
|
|
|
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Update a specified record. |
57
|
|
|
* |
58
|
|
|
* @param Request $request |
59
|
|
|
* @param int $id |
60
|
|
|
* |
61
|
|
|
* @return \Huntie\JsonApi\Http\JsonApiResponse |
62
|
|
|
*/ |
63
|
|
|
public function update(Request $request, $id) |
64
|
|
|
{ |
65
|
|
|
return parent::updateAction($request, $id); |
|
|
|
|
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Destroy a specified record. |
70
|
|
|
* |
71
|
|
|
* @param Request $request |
72
|
|
|
* @param int $id |
73
|
|
|
* |
74
|
|
|
* @return \Huntie\JsonApi\Http\JsonApiResponse |
75
|
|
|
*/ |
76
|
|
|
public function destroy(Request $request, $id) |
77
|
|
|
{ |
78
|
|
|
return parent::destroyAction($request, $id); |
|
|
|
|
79
|
|
|
} |
80
|
|
|
} |
81
|
|
|
|
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()
method in theSon
calls the wrong method in the parent class.