/**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(History $historyModel, Provider $providerModel, Request $request)
 {
     if (isset($_POST['create_provider'])) {
         if (!right('EditProvider')) {
             abort(404);
         }
         if (strlen($request->input('name')) > 0) {
             $data = array('name' => $request->input('name'), 'note' => $request->input('note'));
             $providerModel->createProvider($data);
             $historyModel->saveHistory('create_provider', $request->input('name'));
             Session::flash('message', GetMessages("SUCCESS_CREATE_NEW_PROVIDER"));
             return redirect()->route('provider.index');
         } else {
             Session::flash('message', GetMessages("ERROR_EMPTY_NAME_PROVIDER"));
             return redirect($_SERVER['HTTP_REFERER']);
         }
     }
 }