Пример #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 = Meal1::create($request->all());
     $item->saveImage($item, $request);
     Flash::success("Запись - {$item->id} сохранена");
     return redirect(route('admin.meal1.index'));
 }
Пример #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('meal1')->delete();
     for ($i = 0; $i < count($this->items); $i++) {
         $row = array_combine(['name', 'description', 'consist', 'weight', 'price', 'image'], $this->items[$i]);
         Meal1::create($row);
     }
 }