public function update($id, Requests\ShopRequest $request) { $shop = Shop::findOrFail($id); $shop->update($request->all()); flash()->success('Part Type has been updated.'); return redirect('shops'); }
public function store(Requests\ShopRequest $request) { $shop = new Shop(); $shop->shop_name = $request->get('shop_name'); $shop->address = $request->get('address'); $shop->description = $request->get('description'); $shop->email = $request->get('email'); $shop->phone_num = $request->get('phone_num'); if ($request->hasFile('profilePicFile')) { $file = Input::file('profilePicFile'); $name = Auth::user()->user_id . '-' . $file->getClientOriginalName(); $shop->picture = $name; $file->move(public_path() . '/images/shop/', $name); } Auth::user()->Items()->save($shop); return \Redirect::back()->with('message', 'Your shop has been creatrd successfully.'); }
public function editShop(Requests\ShopRequest $request, $id) { if ($request->ajax()) { $shop = Shop::find($id); $shop->name = $request->name; $shop->place = $request->place; $shop->info = $request->info; $shop->userId = $request->userId; $shop->instagram = $request->instagram; $shop->facebook = $request->facebook; $shop->phone1 = $request->phone1; $shop->phone2 = $request->phone2; $shop->cat()->sync($request->catId); $shop->save(); TradingHour::where('shopId', '=', $id)->update(array('monday' => $request->monday, 'tuesday' => $request->tuesday, 'wednesday' => $request->wednesday, 'thursday' => $request->thursday, 'friday' => $request->friday, 'saturday' => $request->saturday, 'sunday' => $request->sunday)); DB::table('last_modifications')->truncate(); DB::table('last_modifications')->insert(['date' => Carbon::now()]); } }