Ejemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param Request $request
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['name' => 'required']);
     $item = Salad::create($request->all());
     $item->saveImage($item, $request);
     Flash::success("Запись - {$item->id} сохранена");
     return redirect(route('admin.salads.index'));
 }
Ejemplo n.º 2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('salads')->delete();
     for ($i = 0; $i < count($this->items); $i++) {
         $row = array_combine(['name', 'description', 'consist', 'weight', 'price', 'image'], $this->items[$i]);
         Salad::create($row);
     }
 }