| @@ 50-63 (lines=14) @@ | ||
| 47 | * |
|
| 48 | * @return \Illuminate\Http\Response |
|
| 49 | */ |
|
| 50 | public function index() |
|
| 51 | { |
|
| 52 | $this->repository->pushCriteria(app('Prettus\Repository\Criteria\RequestCriteria')); |
|
| 53 | $enrollments = $this->repository->all(); |
|
| 54 | ||
| 55 | if (request()->wantsJson()) { |
|
| 56 | ||
| 57 | return response()->json([ |
|
| 58 | 'data' => $enrollments, |
|
| 59 | ]); |
|
| 60 | } |
|
| 61 | ||
| 62 | return view('enrollments.index', compact('enrollments')); |
|
| 63 | } |
|
| 64 | ||
| 65 | /** |
|
| 66 | * Store a newly created resource in storage. |
|
| @@ 112-124 (lines=13) @@ | ||
| 109 | * |
|
| 110 | * @return \Illuminate\Http\Response |
|
| 111 | */ |
|
| 112 | public function show($id) |
|
| 113 | { |
|
| 114 | $enrollment = $this->repository->find($id); |
|
| 115 | ||
| 116 | if (request()->wantsJson()) { |
|
| 117 | ||
| 118 | return response()->json([ |
|
| 119 | 'data' => $enrollment, |
|
| 120 | ]); |
|
| 121 | } |
|
| 122 | ||
| 123 | return view('enrollments.show', compact('enrollment')); |
|
| 124 | } |
|
| 125 | ||
| 126 | ||
| 127 | /** |
|