Total Complexity | 8 |
Total Lines | 83 |
Duplicated Lines | 0 % |
Coverage | 78.26% |
Changes | 0 |
1 | <?php |
||
12 | class JobApiController extends Controller |
||
13 | { |
||
14 | 4 | public function __construct() |
|
18 | 4 | } |
|
19 | |||
20 | /** |
||
21 | * Convert a job poster to the array expected by API requests, |
||
22 | * with all criteria, |
||
23 | * and with translation arrays in both languages. |
||
24 | * |
||
25 | * @param JobPoster $job |
||
1 ignored issue
–
show
|
|||
26 | * @return mixed[] |
||
27 | */ |
||
28 | 2 | private function jobToArray(JobPoster $job) |
|
37 | } |
||
38 | /** |
||
39 | * Display a listing of the resource. |
||
40 | * |
||
41 | * @return \Illuminate\Http\Response |
||
1 ignored issue
–
show
|
|||
42 | */ |
||
43 | public function index() |
||
44 | { |
||
45 | //TODO: complete |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * Store a newly created resource in storage. |
||
50 | * |
||
51 | * @param \Illuminate\Http\Request $request |
||
2 ignored issues
–
show
|
|||
52 | * @return \Illuminate\Http\Response |
||
1 ignored issue
–
show
|
|||
53 | */ |
||
54 | public function store(Request $request) |
||
56 | //TODO: complete |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * Display the specified resource. |
||
61 | * |
||
62 | * @param JobPoster $job |
||
1 ignored issue
–
show
|
|||
63 | * @return \Illuminate\Http\Response |
||
64 | */ |
||
65 | 1 | public function show(JobPoster $job) |
|
66 | { |
||
67 | 1 | return $this->jobToArray($job); |
|
1 ignored issue
–
show
|
|||
68 | } |
||
69 | |||
70 | /** |
||
1 ignored issue
–
show
|
|||
71 | * Update the specified resource in storage. |
||
72 | * |
||
73 | * @param App\Http\Requests\UpdateJobPoster $request Validates input. |
||
2 ignored issues
–
show
|
|||
74 | * @param JobPoster $jobPoser |
||
2 ignored issues
–
show
|
|||
75 | * @return \Illuminate\Http\Response |
||
76 | */ |
||
77 | 1 | public function update(UpdateJobPoster $request, JobPoster $job) |
|
78 | { |
||
79 | 1 | $request->validated(); |
|
80 | 1 | JobPosterValidator::validateUnpublished($job); |
|
81 | // Only values in the JobPoster->fillable array will be set |
||
82 | 1 | $job->fill($request->input()); |
|
83 | 1 | $job->save(); |
|
84 | 1 | return $this->jobToArray($job); |
|
1 ignored issue
–
show
|
|||
85 | } |
||
86 | |||
87 | /** |
||
88 | * Remove the specified resource from storage. |
||
89 | * |
||
90 | * @param int $id |
||
2 ignored issues
–
show
|
|||
91 | * @return \Illuminate\Http\Response |
||
1 ignored issue
–
show
|
|||
92 | */ |
||
93 | public function destroy($id) |
||
95 | // TODO: |
||
96 | } |
||
97 | } |
||
98 |