Пример #1
0
 public function destroy($id)
 {
     if (Auth::user()->can('delete-colors')) {
         $color = Color::findOrFail($id);
         Color::destroy($id);
         Session::flash('message', trans('car::ui.color.message_delete', array('name' => $color->name)));
         return redirect('car/color');
     }
     return redirect('auth/logout');
 }
Пример #2
0
 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');
 }