コード例 #1
2
 public function store(LocationRequest $request)
 {
     $location = Location::create($request->all());
     Session::flash('success', true);
     Session::flash('message', 'Aðgerð tókst: Ný staðsetning');
     return Redirect::back();
 }
コード例 #2
0
ファイル: LocationController.php プロジェクト: romulodl/swim
 public function update(LocationRequest $request, $id)
 {
     $location = \App\Location::findOrFail($id);
     $location->update($request->all());
     \Session::flash('flash_message', 'Location has been updated.');
     return redirect('locations');
 }
コード例 #3
0
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(LocationRequest $request, $id)
 {
     $location = Location::findOrFail($id);
     $location->fill($request->all());
     $location->save();
     return Redirect::back()->with("good", "Successfully updated location.");
 }
コード例 #4
0
 public function store(LocationRequest $request)
 {
     /*
     get all input fields except comment which we are saving to different table
     
     also possible to write as Request::all(), Request::except('comment') ...
     */
     $newLocation = Location::create($request->all());
     flash()->success('Location has been created!');
 }
コード例 #5
0
 /**
  * Apply the updates to our resource
  */
 public function update($id, LocationRequest $request)
 {
     // if guest or cannot location.edit, redirect -> home
     if (Entrust::can('location.edit') == false) {
         return redirect()->route('home');
     }
     if (isset($request->btn_Cancel)) {
         return redirect()->route('location.show', ['id' => $id]);
     }
     $this->transaction(function ($this) use($id, $request) {
         // using an implementation of the Location Repository Interface
         $this->locationRepository->update($id, $request->all());
         // temp code until a second warehouse is created
         $warehouses = $this->warehouseRepository->filterOn(['Warehouse_Code' => 'CALEDON']);
         $this->doLocate($id, $warehouses[0]->objectID);
     });
     return redirect()->route('location.show', ['id' => $id])->with(['status' => Lang::get('internal.updated', ['class' => Location::TABLE_NAME])]);
 }