public function destroy($id) { if (Auth::user()->can('delete-prototypes')) { $prototype = Prototype::findOrFail($id); Prototype::destroy($id); Session::flash('message', trans('car::ui.prototype.message_delete', array('name' => $prototype->name))); return redirect('car/model'); } return redirect('auth/logout'); }
public function edit($id) { if (Auth::user()->can('update-cars')) { $car = Car::findOrFail($id); $brands = Brand::orderBy('name', 'asc')->lists('name', 'id'); $prototypes = Prototype::orderBy('name', 'asc')->lists('name', 'id'); $colors = Color::orderBy('name', 'asc')->lists('name', 'id'); $conditions = Condition::orderBy('name', 'asc')->lists('name', 'id'); return view('car::edit', compact('car', 'brands', 'prototypes', 'colors', 'conditions')); } return redirect('auth/logout'); }