Пример #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(UnitRequest $request)
 {
     $unit = Unit::create($request->all());
     if ($unit) {
         Flash::success('添加成功!');
     } else {
         Flash::error('添加失败!');
     }
     return Redirect::to('/admin/unit/');
 }
Пример #2
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(UnitRequest $request, $id)
 {
     try {
         $this->unit->update($id, $request->only('description', 'symbol', 'block'));
         return redirect()->action('UnitController@index');
     } catch (Exception $e) {
         return redirect()->back()->withInput()->with('error', 'Không thể truy vấn dữ liệu');
     }
 }