We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| @@ 12-124 (lines=113) @@ | ||
| 9 | /** |
|
| 10 | * The controller that handles all the crud actions |
|
| 11 | */ |
|
| 12 | class CrudController extends BaseController |
|
| 13 | { |
|
| 14 | protected $crud; |
|
| 15 | protected $data; |
|
| 16 | ||
| 17 | public function __construct() |
|
| 18 | { |
|
| 19 | $this->crud = new Crud(); |
|
| 20 | $this->data = []; |
|
| 21 | } |
|
| 22 | ||
| 23 | /** |
|
| 24 | * Display a listing of the resource. |
|
| 25 | * |
|
| 26 | * @return \Illuminate\Http\Response |
|
| 27 | */ |
|
| 28 | public function index() |
|
| 29 | { |
|
| 30 | // dd($this->crud); |
|
| 31 | $this->crud->checkPermission('list'); |
|
| 32 | ||
| 33 | return view('crud::layouts.list', $this->data + ['crud' => $this->crud]); |
|
| 34 | } |
|
| 35 | ||
| 36 | /** |
|
| 37 | * Show the form for creating a new resource. |
|
| 38 | * |
|
| 39 | * @return \Illuminate\Http\Response |
|
| 40 | */ |
|
| 41 | public function create() |
|
| 42 | { |
|
| 43 | // dd($this->crud); |
|
| 44 | $this->crud->checkPermission('add'); |
|
| 45 | ||
| 46 | return view('crud::layouts.create', $this->data + ['crud' => $this->crud]); |
|
| 47 | } |
|
| 48 | ||
| 49 | /** |
|
| 50 | * Store a newly created resource in storage. |
|
| 51 | * |
|
| 52 | * @param \Illuminate\Http\Request $request |
|
| 53 | * @return \Illuminate\Http\Response |
|
| 54 | */ |
|
| 55 | public function crudStore(Request $request = null) |
|
| 56 | { |
|
| 57 | // $this->crud->checkPermission('add'); |
|
| 58 | // dd($request); |
|
| 59 | $entity = $this->crud->save(\Request::all()); |
|
| 60 | ||
| 61 | // return \Redirect::to($this->crud->getRoute()."/{$entity->id}/edit")->with('status', trans('crud::crud.form.create_success')); |
|
| 62 | return \Redirect::to($this->crud->getRoute())->with('status', trans('crud::crud.form.create_success')); |
|
| 63 | } |
|
| 64 | ||
| 65 | /** |
|
| 66 | * Display the specified resource. |
|
| 67 | * |
|
| 68 | * @param int $id |
|
| 69 | * @return \Illuminate\Http\Response |
|
| 70 | */ |
|
| 71 | public function show($id) |
|
| 72 | { |
|
| 73 | $this->crud->checkPermission('view'); |
|
| 74 | $this->crud->item($id); |
|
| 75 | ||
| 76 | return view('crud::layouts.show', $this->data + ['crud' => $this->crud]); |
|
| 77 | } |
|
| 78 | ||
| 79 | /** |
|
| 80 | * Show the form for editing the specified resource. |
|
| 81 | * |
|
| 82 | * @param int $id |
|
| 83 | * @return \Illuminate\Http\Response |
|
| 84 | */ |
|
| 85 | public function edit($id) |
|
| 86 | { |
|
| 87 | $this->crud->checkPermission('edit'); |
|
| 88 | $this->crud->item($id); |
|
| 89 | ||
| 90 | // dd($this->crud->item->toArray()); |
|
| 91 | ||
| 92 | return view('crud::layouts.edit', $this->data + ['crud' => $this->crud]); |
|
| 93 | ||
| 94 | } |
|
| 95 | /** |
|
| 96 | * Update the specified resource in storage. |
|
| 97 | * |
|
| 98 | * @param \Illuminate\Http\Request $request |
|
| 99 | * @param int $id |
|
| 100 | * @return \Illuminate\Http\Response |
|
| 101 | */ |
|
| 102 | public function crudUpdate($id, Request $request = null) |
|
| 103 | { |
|
| 104 | $this->crud->checkPermission('edit'); |
|
| 105 | $this->crud->item($id); |
|
| 106 | ||
| 107 | $entity = $this->crud->update($id, \Request::all()); |
|
| 108 | ||
| 109 | return \Redirect::to($this->crud->getRoute())->with('status', trans('crud::crud.form.save_success')); |
|
| 110 | } |
|
| 111 | ||
| 112 | /** |
|
| 113 | * Remove the specified resource from storage. |
|
| 114 | * |
|
| 115 | * @param int $id |
|
| 116 | * @return \Illuminate\Http\Response |
|
| 117 | */ |
|
| 118 | public function destroy($id) |
|
| 119 | { |
|
| 120 | $this->crud->checkPermission('delete'); |
|
| 121 | ||
| 122 | return $this->crud->delete($id); |
|
| 123 | } |
|
| 124 | } |
|
| @@ 16-128 (lines=113) @@ | ||
| 13 | /** |
|
| 14 | * The controller that handles all the crud actions |
|
| 15 | */ |
|
| 16 | class CrudNestedController extends BaseController |
|
| 17 | { |
|
| 18 | protected $crud; |
|
| 19 | protected $data; |
|
| 20 | ||
| 21 | public function __construct() |
|
| 22 | { |
|
| 23 | $this->crud = new Crud(); |
|
| 24 | $this->data = []; |
|
| 25 | } |
|
| 26 | ||
| 27 | /** |
|
| 28 | * Display a listing of the resource. |
|
| 29 | * |
|
| 30 | * @return \Illuminate\Http\Response |
|
| 31 | */ |
|
| 32 | public function index($parentId) |
|
| 33 | { |
|
| 34 | // dd($this->crud); |
|
| 35 | $this->crud->checkPermission('list'); |
|
| 36 | ||
| 37 | return view('crud::layouts.list', $this->data + ['crud' => $this->crud]); |
|
| 38 | } |
|
| 39 | ||
| 40 | /** |
|
| 41 | * Show the form for creating a new resource. |
|
| 42 | * |
|
| 43 | * @return \Illuminate\Http\Response |
|
| 44 | */ |
|
| 45 | public function create($parentId) |
|
| 46 | { |
|
| 47 | // dd($this->crud); |
|
| 48 | $this->crud->checkPermission('add'); |
|
| 49 | ||
| 50 | return view('crud::layouts.create', $this->data + ['crud' => $this->crud]); |
|
| 51 | } |
|
| 52 | ||
| 53 | /** |
|
| 54 | * Store a newly created resource in storage. |
|
| 55 | * |
|
| 56 | * @param \Illuminate\Http\Request $request |
|
| 57 | * @return \Illuminate\Http\Response |
|
| 58 | */ |
|
| 59 | public function crudStore(Request $request = null) |
|
| 60 | { |
|
| 61 | // $this->crud->checkPermission('add'); |
|
| 62 | // dd($request); |
|
| 63 | $entity = $this->crud->save(\Request::all()); |
|
| 64 | ||
| 65 | // return \Redirect::to($this->crud->getRoute()."/{$entity->id}/edit")->with('status', trans('crud::crud.form.create_success')); |
|
| 66 | return \Redirect::to($this->crud->getRoute())->with('status', trans('crud::crud.form.create_success')); |
|
| 67 | } |
|
| 68 | ||
| 69 | /** |
|
| 70 | * Display the specified resource. |
|
| 71 | * |
|
| 72 | * @param int $id |
|
| 73 | * @return \Illuminate\Http\Response |
|
| 74 | */ |
|
| 75 | public function show($parentId, $id) |
|
| 76 | { |
|
| 77 | $this->crud->checkPermission('view'); |
|
| 78 | $this->crud->item($id); |
|
| 79 | ||
| 80 | return view('crud::layouts.show', $this->data + ['crud' => $this->crud]); |
|
| 81 | } |
|
| 82 | ||
| 83 | /** |
|
| 84 | * Show the form for editing the specified resource. |
|
| 85 | * |
|
| 86 | * @param int $id |
|
| 87 | * @return \Illuminate\Http\Response |
|
| 88 | */ |
|
| 89 | public function edit($parentId, $id) |
|
| 90 | { |
|
| 91 | $this->crud->checkPermission('edit'); |
|
| 92 | $this->crud->item($id); |
|
| 93 | ||
| 94 | // dd($this->crud->item->toArray()); |
|
| 95 | ||
| 96 | return view('crud::layouts.edit', $this->data + ['crud' => $this->crud]); |
|
| 97 | ||
| 98 | } |
|
| 99 | /** |
|
| 100 | * Update the specified resource in storage. |
|
| 101 | * |
|
| 102 | * @param \Illuminate\Http\Request $request |
|
| 103 | * @param int $id |
|
| 104 | * @return \Illuminate\Http\Response |
|
| 105 | */ |
|
| 106 | public function crudUpdate($parentId, $id, Request $request = null) |
|
| 107 | { |
|
| 108 | $this->crud->checkPermission('edit'); |
|
| 109 | $this->crud->item($id); |
|
| 110 | ||
| 111 | $entity = $this->crud->update($id, \Request::all()); |
|
| 112 | ||
| 113 | return \Redirect::to($this->crud->getRoute())->with('status', trans('crud::crud.form.save_success')); |
|
| 114 | } |
|
| 115 | ||
| 116 | /** |
|
| 117 | * Remove the specified resource from storage. |
|
| 118 | * |
|
| 119 | * @param int $id |
|
| 120 | * @return \Illuminate\Http\Response |
|
| 121 | */ |
|
| 122 | public function destroy($parentId, $id) |
|
| 123 | { |
|
| 124 | $this->crud->checkPermission('delete'); |
|
| 125 | ||
| 126 | return $this->crud->delete($id); |
|
| 127 | } |
|
| 128 | } |
|