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