4
|
1 |
<?php |
|
2 |
|
|
3 |
namespace CorpusParole\Http\Controllers\Api; |
|
4 |
|
|
5 |
use Illuminate\Http\Request; |
|
6 |
|
|
7 |
use CorpusParole\Http\Requests; |
|
8 |
use CorpusParole\Http\Controllers\Controller; |
|
9 |
use CorpusParole\Repositories\DocumentRepository; |
|
10 |
|
|
11 |
class DocumentController extends Controller |
|
12 |
{ |
|
13 |
/** |
|
14 |
* Create a new controller instance. |
|
15 |
*/ |
|
16 |
public function __construct(DocumentRepository $documentRepo) { |
|
17 |
$this->documentRepository = $documentRepo; |
|
18 |
} |
|
19 |
|
|
20 |
/** |
|
21 |
* Display a listing of the resource. |
|
22 |
* |
|
23 |
* @return Response |
|
24 |
*/ |
|
25 |
public function index() |
|
26 |
{ |
|
27 |
return response()->json($this->documentRepository->paginateAll()); |
|
28 |
} |
|
29 |
|
|
30 |
/** |
|
31 |
* Show the form for creating a new resource. |
|
32 |
* |
|
33 |
* @return Response |
|
34 |
*/ |
|
35 |
public function create() |
|
36 |
{ |
|
37 |
// |
|
38 |
} |
|
39 |
|
|
40 |
/** |
|
41 |
* Store a newly created resource in storage. |
|
42 |
* |
|
43 |
* @param Request $request |
|
44 |
* @return Response |
|
45 |
*/ |
|
46 |
public function store(Request $request) |
|
47 |
{ |
|
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 |
$doc = $this->documentRepository->get($id); |
|
60 |
if(is_null($doc)) { |
|
61 |
abort(404); |
|
62 |
} |
|
63 |
return response()->json($doc); |
|
64 |
} |
|
65 |
|
|
66 |
/** |
|
67 |
* Show the form for editing the specified resource. |
|
68 |
* |
|
69 |
* @param int $id |
|
70 |
* @return Response |
|
71 |
*/ |
|
72 |
public function edit($id) |
|
73 |
{ |
|
74 |
// |
|
75 |
} |
|
76 |
|
|
77 |
/** |
|
78 |
* Update the specified resource in storage. |
|
79 |
* |
|
80 |
* @param Request $request |
|
81 |
* @param int $id |
|
82 |
* @return Response |
|
83 |
*/ |
|
84 |
public function update(Request $request, $id) |
|
85 |
{ |
|
86 |
// |
|
87 |
} |
|
88 |
|
|
89 |
/** |
|
90 |
* Remove the specified resource from storage. |
|
91 |
* |
|
92 |
* @param int $id |
|
93 |
* @return Response |
|
94 |
*/ |
|
95 |
public function destroy($id) |
|
96 |
{ |
|
97 |
// |
|
98 |
} |
|
99 |
} |