| Total Complexity | 8 |
| Total Lines | 84 |
| Duplicated Lines | 0 % |
| Coverage | 78.26% |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | class JobApiController extends Controller |
||
| 13 | { |
||
| 14 | 4 | public function __construct() |
|
|
1 ignored issue
–
show
|
|||
| 15 | { |
||
| 16 | // This applies the appropriate policy to each resource route |
||
| 17 | 4 | $this->authorizeResource(JobPoster::class, 'job'); |
|
| 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) |
|
| 38 | } |
||
| 39 | /** |
||
| 40 | * Display a listing of the resource. |
||
| 41 | * |
||
| 42 | * @return \Illuminate\Http\Response |
||
|
1 ignored issue
–
show
|
|||
| 43 | */ |
||
| 44 | public function index() |
||
| 45 | { |
||
| 46 | //TODO: complete |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Store a newly created resource in storage. |
||
| 51 | * |
||
| 52 | * @param \Illuminate\Http\Request $request |
||
|
2 ignored issues
–
show
|
|||
| 53 | * @return \Illuminate\Http\Response |
||
|
1 ignored issue
–
show
|
|||
| 54 | */ |
||
| 55 | public function store(Request $request) |
||
| 57 | //TODO: complete |
||
| 58 | } |
||
| 59 | |||
| 60 | /** |
||
| 61 | * Display the specified resource. |
||
| 62 | * |
||
| 63 | * @param JobPoster $job |
||
|
1 ignored issue
–
show
|
|||
| 64 | * @return \Illuminate\Http\Response |
||
| 65 | */ |
||
| 66 | 1 | public function show(JobPoster $job) |
|
| 67 | { |
||
| 68 | 1 | return $this->jobToArray($job); |
|
|
1 ignored issue
–
show
|
|||
| 69 | } |
||
| 70 | |||
| 71 | /** |
||
|
1 ignored issue
–
show
|
|||
| 72 | * Update the specified resource in storage. |
||
| 73 | * |
||
| 74 | * @param App\Http\Requests\UpdateJobPoster $request Validates input. |
||
|
2 ignored issues
–
show
|
|||
| 75 | * @param JobPoster $jobPoser |
||
|
2 ignored issues
–
show
|
|||
| 76 | * @return \Illuminate\Http\Response |
||
| 77 | */ |
||
| 78 | 1 | public function update(UpdateJobPoster $request, JobPoster $job) |
|
| 79 | { |
||
| 80 | 1 | $request->validated(); |
|
| 81 | 1 | JobPosterValidator::validateUnpublished($job); |
|
| 82 | // Only values in the JobPoster->fillable array will be set |
||
| 83 | 1 | $job->fill($request->input()); |
|
| 84 | 1 | $job->save(); |
|
| 85 | 1 | return $this->jobToArray($job); |
|
|
1 ignored issue
–
show
|
|||
| 86 | } |
||
| 87 | |||
| 88 | /** |
||
| 89 | * Remove the specified resource from storage. |
||
| 90 | * |
||
| 91 | * @param int $id |
||
|
2 ignored issues
–
show
|
|||
| 92 | * @return \Illuminate\Http\Response |
||
|
1 ignored issue
–
show
|
|||
| 93 | */ |
||
| 94 | public function destroy($id) |
||
| 96 | // TODO: |
||
| 97 | } |
||
| 98 | } |
||
| 99 |