1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Chriscreates\Blog\Controllers; |
4
|
|
|
|
5
|
|
|
use Chriscreates\Blog\Requests\ValidateTagRequest; |
6
|
|
|
use Chriscreates\Blog\Tag; |
7
|
|
|
use Illuminate\Http\JsonResponse; |
8
|
|
|
use Illuminate\Http\Request; |
9
|
|
|
|
10
|
|
|
class TagController extends Controller |
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* Instantiate a new controller instance. |
14
|
|
|
* |
15
|
|
|
* @return void |
|
|
|
|
16
|
|
|
*/ |
17
|
|
|
public function __construct() |
18
|
|
|
{ |
19
|
|
|
$this->middleware('auth'); |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Display a listing of the resource. |
24
|
|
|
* |
25
|
|
|
* @return \Illuminate\Http\Response |
26
|
|
|
*/ |
27
|
|
|
public function index() : JsonResponse |
28
|
|
|
{ |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Store a newly created resource in storage. |
33
|
|
|
* |
34
|
|
|
* @param \Chriscreates\Blog\Requests\ValidateTagRequest $request |
35
|
|
|
* @return \Illuminate\Http\Response |
36
|
|
|
*/ |
37
|
|
|
public function store(ValidateTagRequest $request) : JsonResponse |
38
|
|
|
{ |
39
|
|
|
$tag = Tag::create($request->only([ |
40
|
|
|
'name', |
41
|
|
|
'slug', |
42
|
|
|
])); |
43
|
|
|
|
44
|
|
|
return response()->json($tag); |
|
|
|
|
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Show the form for editing the specified resource. |
49
|
|
|
* |
50
|
|
|
* @param \Chriscreates\Blog\Tag $tag |
51
|
|
|
* @return \Illuminate\Http\Response |
52
|
|
|
*/ |
53
|
|
|
public function edit(Tag $tag) : JsonResponse |
|
|
|
|
54
|
|
|
{ |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Update the specified resource in storage. |
59
|
|
|
* |
60
|
|
|
* @param \Chriscreates\Blog\Requests\ValidateTagRequest $request |
61
|
|
|
* @param \Chriscreates\Blog\Tag $tag |
62
|
|
|
* @return \Illuminate\Http\Response |
63
|
|
|
*/ |
64
|
|
|
public function update(ValidateTagRequest $request, Tag $tag) : JsonResponse |
|
|
|
|
65
|
|
|
{ |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Remove the specified resource from storage. |
70
|
|
|
* |
71
|
|
|
* @param \Chriscreates\Blog\Tag $tag |
72
|
|
|
* @return \Illuminate\Http\Response |
73
|
|
|
*/ |
74
|
|
|
public function destroy(Tag $tag) : JsonResponse |
|
|
|
|
75
|
|
|
{ |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.