Ejemplo n.º 1
0
 /**
  * Validates and stores the new depreciation data.
  *
  * @author [A. Gianotto] [<snipe@snipe.net]
  * @see DepreciationsController::postCreate()
  * @since [v1.0]
  * @return Redirect
  */
 public function postCreate()
 {
     // get the POST data
     $new = Input::all();
     // create a new instance
     $depreciation = new Depreciation();
     // Depreciation data
     $depreciation->name = e(Input::get('name'));
     $depreciation->months = e(Input::get('months'));
     $depreciation->user_id = Auth::user()->id;
     // Was the asset created?
     if ($depreciation->save()) {
         // Redirect to the new depreciation  page
         return redirect()->to("admin/settings/depreciations")->with('success', trans('admin/depreciations/message.create.success'));
     }
     return redirect()->back()->withInput()->withErrors($depreciation->getErrors());
 }