/**
  * Store a newly created resource in storage.
  * POST /users
  *
  * @return Response
  */
 public function store()
 {
     Input::merge(array_map('trim', Input::all()));
     $input = Input::all();
     $validation = Validator::make($input, User::$rules);
     if ($validation->passes()) {
         DB::transaction(function () {
             $user = new User();
             $user->first_name = strtoupper(Input::get('first_name'));
             $user->middle_initial = strtoupper(Input::get('middle_initial'));
             $user->last_name = strtoupper(Input::get('last_name'));
             $user->dept_id = Input::get('department');
             $user->confirmed = 1;
             $user->active = 1;
             $user->email = Input::get('email');
             $user->username = Input::get('username');
             $user->password = Input::get('password');
             $user->password_confirmation = Input::get('password_confirmation');
             $user->confirmation_code = md5(uniqid(mt_rand(), true));
             $user->image = "default.png";
             $user->save();
             $role = Role::find(Input::get('name'));
             $user->roles()->attach($role->id);
         });
         return Redirect::route('user.index')->with('class', 'success')->with('message', 'Record successfully added.');
     } else {
         return Redirect::route('user.create')->withInput(Input::except(array('password', 'password_confirmation')))->withErrors($validation)->with('class', 'error')->with('message', 'There were validation errors.');
     }
 }
Example #2
0
 public function test_it_handles_filtering()
 {
     \Input::merge(['dvs-filters' => ['slug' => '/admin/media-manager/category']]);
     $pages = \DvsPage::paginate();
     // are pages filtered?
     // assertCount(2, $pages);
 }
Example #3
0
 public function postVote()
 {
     Input::merge(array_map('trim', Input::all()));
     $input = Input::all();
     $rules = array('MCUsername' => 'required|max:40', 'g-recaptcha-response' => 'required|recaptcha', 'sid' => 'required');
     $v = Validator::make($input, $rules);
     $sid = $input['sid'];
     $server = DB::table('mcservers')->where('mcs_id', '=', $sid)->first();
     if (!count($server)) {
         return Redirect::to('/minecraft/' . $sid)->withErrors("Ocorreu um erro com a validação do servidor");
     }
     if ($v->passes()) {
         if (mcservers::playerHasVoted($sid, $input['MCUsername']) || mcservers::ipHasVoted($sid, $_SERVER["HTTP_CF_CONNECTING_IP"])) {
             return Redirect::to('/minecraft/' . $sid)->withErrors("Já votaste hoje");
         }
         if ($server->mcs_votifier == 1) {
             $votifier = Votifier::newVote($server->mcs_ip, $server->mcs_vport, $server->mcs_votifierkey, $input['MCUsername']);
             if ($votifier == false) {
                 return Redirect::to('/minecraft/' . $sid)->withErrors("Não foi possivel enviar o voto para o servidor, porfavor contacta o admininstrador do mesmo");
             }
         }
         if (Auth::check()) {
             DB::table('users')->where('id', Auth::user()->id)->update(array('votes' => Auth::user()->votes + 1));
             utilities::log("Voted On Server " . $server->mcs_name);
         }
         DB::table('mcservers')->where('mcs_id', $sid)->update(array('mcs_tvotes' => $server->mcs_tvotes + 1, 'mcs_mvotes' => $server->mcs_mvotes + 1));
         DB::table('mcserversvotes')->insert(array('mcsv_sid' => $sid, 'mcsv_player' => $input['MCUsername'], 'mcsv_ip' => $_SERVER["HTTP_CF_CONNECTING_IP"], 'mcsv_day' => date("j"), 'mcsv_month' => date("n"), 'mcsv_year' => date("Y")));
         return Redirect::to('/minecraft/' . $sid)->With('success', 'Voto Registado!');
     } else {
         return Redirect::to('/minecraft/' . $sid)->withErrors($v);
     }
 }
 public function cost_detail()
 {
     // 默认渲染数据
     $render_data = ['previous_input' => ['date' => '', 'cost_type' => '10'], 'results' => []];
     $params = Input::all();
     // 参数非空,且指定查询的消费类型,且指定的消费类型有效
     if (!empty($params)) {
         // 默认第一页
         if (!Input::has('page')) {
             $params['page'] = 1;
         }
         if (!Input::has('date')) {
             $params['date'] = date('Y-m');
         }
         Input::merge($params);
         $render_data['previous_input'] = array_merge($render_data['previous_input'], $params);
         // 查询充值记录
         if ($params['cost_type'] == '10') {
             // 先查询费用类型
             $fee_type = FeeType::select('id', 'category', 'item')->where('category', '10')->first();
             // 查询费用明细所必须条件
             $render_data['results'] = CostDetail::select('cost_id', 'created_at', 'fee_type_id', 'number')->where('user_id', Sentry::getUser()->user_id)->where('fee_type_id', $fee_type->id)->where('created_at', 'like', $params['date'] . '%')->orderBy('created_at', 'desc')->get();
         } else {
             if ($params['cost_type'] == '20') {
                 $date = Carbon::parse(Input::get('date'));
                 $date_start = $date->timestamp * 1000;
                 $date->addMonth();
                 $date_end = $date->timestamp * 1000;
                 $render_data['results'] = BusinessController::count(Sentry::getUser()->user_id, $date_start, $date_end);
             }
         }
     }
     return View::make('pages.finance-center.cost-manage.cost-detail', $render_data);
 }
 public function testAuthState_authStateAccurateForLoggedInStateWithActing()
 {
     $role = UserRole::where('name', '=', UserRole::ACTOR_ROLE)->first();
     $user = factory(App\Models\User::class, 1)->create();
     $user->password = '******';
     $user->save();
     $user2 = factory(App\Models\User::class, 1)->create();
     $user2->password = '******';
     $user2->save();
     $user->roles()->attach($role);
     App::bindShared('oauth2-server.authorizer', function () use($user) {
         $mock = Mockery::mock(\LucaDegasperi\OAuth2Server\Authorizer::class);
         $mock->shouldReceive('getResourceOwnerId')->andReturn($user->id);
         $mock->shouldReceive('getResourceOwnerType')->andReturn("user");
         return $mock;
     });
     Input::merge(array('access_token' => 'random_token'));
     Input::merge(array('act_as' => $user2->id));
     $adapter = App::make(APIAdapter::class);
     $state = $adapter->getAuthState();
     $this->assertFalse($state->rememberMe);
     $this->assertEquals($user->id, $state->userId);
     $this->assertEquals($user2->id, $state->actingUserId);
     $this->assertEquals(APIAdapter::AUTH_MECHANISM, $state->authMechanism);
 }
 /**
  * 로그인 컨트롤러. 
  */
 public function doLogin($userid)
 {
     Input::merge(array('userid' => $userid));
     array_map('trim', Input::only('userid', 'userpw'));
     // 유효성 검사 rule
     $rules = array('userid' => Member::CONSTRAINT_USERID, 'userpw' => Member::CONSTRAINT_USERPW);
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
     }
     $member = Member::where(['userid' => Input::get('userid')])->where(['userpw' => Input::get('userpw')])->first();
     if (isset($member) && $member->getKey() >= 0) {
         // 토큰이 있다면 삭제.
         if ($member->token()) {
             $member->token()->delete();
         }
         // 새로운 토큰 발급.
         $memberToken = new Membertoken();
         $memberToken->token = Membertoken::getNewToken();
         $memberToken->memberSeq = $member->getKey();
         $memberToken->expiretime = Membertoken::getNewExpire();
         $memberToken->save();
         return Utils::result($memberToken->token);
     } else {
         return Utils::result(Utils::CANNOT_LOGIN, true);
     }
 }
Example #7
0
 public function save()
 {
     $name = $this->name();
     $value = Input::get($name, '');
     Input::merge([$name => $value]);
     parent::save();
 }
Example #8
0
 public function post_edit($id)
 {
     // renew the team if necessary
     if (Auth::User()->admin || Auth::User()->is_currently_part_of_exec()) {
         $team = Team::find($id);
         if (!$team->is_active()) {
             if (Input::get('renew')) {
                 Year::current_year()->teams()->attach($team->id);
             }
         } else {
             if (!Input::get('renew')) {
                 Year::current_year()->teams()->detach($team->id);
             }
         }
     }
     $input = Input::get();
     $rules = array('name' => 'required', 'alias' => 'required|max:128', 'description' => 'required');
     $validation = Validator::make($input, $rules);
     if ($validation->passes()) {
         Input::merge(array('privacy' => Input::get('privacy', 0)));
         Team::find($id)->update(Input::except(array('renew')));
         return Redirect::to('rms/teams')->with('success', 'Successfully Edited Team');
     } else {
         return Redirect::to('rms/teams/edit/' . $id)->withErrors($validation)->withInput();
     }
 }
 public function save()
 {
     $name = $this->name();
     if (\Input::has($name)) {
         \Input::merge(array($name => password_hash($this->value(), PASSWORD_BCRYPT)));
         parent::save();
     }
 }
 public function result($freewords, $lang, $area)
 {
     global $data;
     global $settings;
     $this->getAreaGroups();
     $data['station_lines'] = $this->getStationLineList();
     if (Input::get('search_by') == NULL) {
         Input::merge(array('search_by' => 'station'));
     }
     $data['detail_search_by'] = Input::get('search_by');
     // set perPage
     $data['per_page'] = $settings['max_display_list']->default;
     if (in_array(Input::get('per-page'), $settings['max_display_list']->list)) {
         $data['per_page'] = Input::get('per-page');
     }
     if ($freewords != NULL) {
         $data['freewords'] = explode(' ', str_replace(' ', ' ', $freewords));
         Input::merge(array('freeword' => $freewords));
     }
     // get review items
     $this->getReviewItems();
     // get items informations
     $this->getItemInformations();
     // get orders
     $this->getOrders();
     // set search conditions
     $conditions = Input::all();
     $data['searchs'] = $conditions;
     // set display ways
     if (Input::get('display_way') != NULL) {
         $data['display_way'] = Input::get('display_way');
     } else {
         $data['display_way'] = $settings['list_display_ways'][0];
     }
     // get sub categories
     $data['sub_categories'] = $this->getSubCategoryList($data['categories'][$data['display_way']]['code']);
     // get lists
     if (Input::get('order') != NULL) {
         if (in_array(Input::get('order'), $data['categories'][$data['display_way']]['settings']['order_lists']['lists'])) {
             $data['order'] = $data['orders'][Input::get('order')];
         } else {
             $data['order'] = $data['orders'][$data['categories'][$data['display_way']]['settings']['order_lists']['default']];
         }
     } else {
         $data['order'] = $data['orders'][$data['categories'][$data['display_way']]['settings']['order_lists']['default']];
     }
     $this->getListsBySearch($data['searchs'], $data['display_way'], $data['per_page'], $data['order']['item'], $data['order']['order']);
     // create metas
     $data['page_keywords'] = $this->createPageKeywords();
     $data['page_title'] = $this->createResultPageTitle();
     $data['title'] = $data['page_title'] . " | " . $data['title'];
     $data['keywords'] = $data['page_title'] . "," . $data['keywords'];
     $data['description'] = $data['page_title'] . " | " . $data['description'];
     $data['breadcrumbs'] = array(array("text" => $data['texts']['home'], "url" => "/"), array("text" => $data['search_ways']['freeword'][$data['language']], "url" => "/freeword"), array("text" => $data['page_title']));
     // set settings
     $this->setSettingsInData();
     return Response::json($data)->setCallback(Input::get('callback'));
 }
 /**
  * Handle the command
  *
  * @param $command
  * @return User
  */
 public function Handle($command)
 {
     $user = User::register($command->email, $command->name, $command->username, $command->password, $command->anonymousUser);
     \Input::merge(['userId' => $user->id]);
     // assign selected roles to the newly registered user
     $this->execute(UpdateUserRolesCommand::class);
     $this->dispatchEventsFor($user);
     return $user;
 }
 /**
  * Display the all the tutors with the serach options
  * @return [type] [description]
  */
 public function display()
 {
     //get the all the tutors first
     $tutors = Tutor::paginate($this->pageLimit);
     $subjects = Subjects::all();
     $levels = Subjects::getLevels();
     $districts = Districts::all();
     Input::merge(['levels' => 'Primary']);
     return View::make('search')->with(compact(['tutors', 'subjects', 'levels', 'districts']));
 }
Example #13
0
 /**
  * Custom API call function
  */
 public function updateRequest($method, $headers = array(), $data = array())
 {
     // Set the custom headers.
     \Request::getFacadeRoot()->headers->replace($headers);
     // Set the custom method.
     \Request::setMethod($method);
     // Set the content body.
     if (is_array($data)) {
         \Input::merge($data);
     }
 }
 /**
  * Process and clean the POSTed data
  *
  * @access protected
  * @return void
  */
 protected function processInput()
 {
     $input = Input::all();
     // Trim leading and trailing whitespace
     // If the control's name is "data", we only trim trailing space
     foreach ($input as $key => $value) {
         $input[$key] = $key == 'data' ? rtrim($value) : trim($value);
     }
     // Merge it back to the Input data
     Input::merge($input);
 }
Example #15
0
 public function save()
 {
     $name = $this->name();
     $value = Input::get($name, '');
     if (!empty($value)) {
         $value = explode(',', $value);
     } else {
         $value = [];
     }
     Input::merge([$name => $value]);
     parent::save();
 }
Example #16
0
function transformMySqlDates($model)
{
    foreach ($model->getDates() as $key) {
        $date = Input::get($key);
        if (is_date($date, 'd-m-Y')) {
            $d = DateTime::createFromFormat('d-m-Y', $date);
            $goodDate = $d->format('Y-m-d');
            Input::merge(array($key => $goodDate));
        }
    }
    return true;
}
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     Input::merge(array('airline_id' => Auth::user()->id));
     //$buyAirplaneModelService = new Game\Services\BuyAirplaneModelService($this->airplaneRepo, $this->airlineRepo); //Tak się nie robi, lepiej skorzystać z IoC container (jak niżej)
     $buyAirplaneModelService = App::make('Game\\Services\\BuyAirplaneModelService');
     //Hihihihi, IoC automatycznie wstrzykuje 2 repozytoria...
     if ($buyAirplaneModelService->buy(AirplaneModel::find(Input::get('airplane_model_id')), Auth::user(), Input::all())) {
         Session::flash('message', 'Samolot został kupiony. Czekaj na dostawę z fabryki.');
         return Redirect::to('airplanes');
     } else {
         return Redirect::to('airplanes/create')->withErrors($buyAirplaneModelService->errors())->withInput(Input::all());
     }
 }
Example #18
0
 /**
  * Custom API call function
  */
 public function updateRequest($method, $headers = array(), $data = array())
 {
     // Log in as admin - header
     $headers['Authorization'] = 'Basic YWRtaW46YWRtaW4=';
     // Set the custom headers.
     \Request::getFacadeRoot()->headers->replace($headers);
     // Set the custom method.
     \Request::setMethod($method);
     // Set the content body.
     if (is_array($data)) {
         \Input::merge($data);
     }
 }
 public function testTake()
 {
     $this->builder->shouldReceive('take')->once()->with(1)->andReturn($this->builder);
     $this->builder->shouldReceive('get')->once()->andReturn(new Collection($this->getRealArray()));
     $this->builder->shouldReceive('count')->twice()->andReturn(10);
     $this->builder->shouldReceive('orderBy')->withAnyArgs()->andReturn($this->builder);
     $this->c = new QueryEngine($this->builder);
     $this->addRealColumns($this->c);
     Input::merge(array('iDisplayLength' => 1, 'sSearch' => null, 'iDisplayStart' => null));
     $this->c->searchColumns('foo');
     $test = json_decode($this->c->make()->getContent());
     $test = $test->aaData;
 }
Example #20
0
 public function testGetApi()
 {
     // Set paging to 2
     \Input::merge(array('limit' => 2));
     // Test the internal model through info
     $controller = \App::make('Tdt\\Core\\Definitions\\InfoController');
     $this->processPaging($controller->handle(''));
     // Test the internal model through definitions
     $this->updateRequest('GET');
     $controller = \App::make('Tdt\\Core\\Definitions\\DefinitionController');
     $this->processPaging($controller->handle(''));
     // Test the internal model through dcat
     $this->processDcat();
 }
 /**
  * Attempt to do login
  *
  * @return  Illuminate\Http\Response
  */
 public function doLogin()
 {
     Input::merge(array_map('trim', Input::all()));
     $input = Input::all();
     $validation = Validator::make($input, User::$login_rules);
     if ($validation->passes()) {
         $username = Input::get('username');
         $password = Input::get('password');
         if (Auth::attempt(array('username' => $username, 'password' => $password, 'active' => 1))) {
             $id = Auth::user()->id;
             $result = Role::storeUserRole($id);
             $results = User::storeUserInfo($id);
             $userinfo = User::storeUser_info_role($id);
             $hasaccess_intask_receiver = Task::access_intask_receiver($id);
             $hasaccess_intask_approver = Task::access_intask_approver($id);
             if ($result) {
                 Session::put('role', $result->role_id);
                 Session::put('fullname', $results->fullname);
                 Session::put('myimage', $results->image);
                 Session::put('name', $userinfo->name);
                 Session::put('task_receiver_access', $hasaccess_intask_receiver);
                 Session::put('task_approver_access', $hasaccess_intask_approver);
                 return Redirect::intended('dashboard');
             } else {
                 return View::make('login.login')->with('class', 'warning')->with('message', 'Invalid username or password.');
             }
         } else {
             return View::make('login.login')->with('class', 'warning')->with('message', 'Invalid username or password.');
         }
     } else {
         return View::make('login.login')->with('class', 'error')->with('message', 'Fill up required fields.');
     }
     // $repo = App::make('UserRepository');
     // $input = Input::all();
     // if ($repo->login($input)) {
     //     return Redirect::intended('/');
     // } else {
     //     if ($repo->isThrottled($input)) {
     //         $err_msg = Lang::get('confide::confide.alerts.too_many_attempts');
     //     } elseif ($repo->existsButNotConfirmed($input)) {
     //         $err_msg = Lang::get('confide::confide.alerts.not_confirmed');
     //     } else {
     //         $err_msg = Lang::get('confide::confide.alerts.wrong_credentials');
     //     }
     //     return Redirect::action('SessionController@login')
     //         ->withInput(Input::except('password'))
     //         ->with('error', $err_msg);
     // }
 }
 /**
  * Create Or Update Oil Company
  */
 public function save()
 {
     Input::merge(array_map('trim', Input::all()));
     $rules = array('company_name' => 'required');
     $messages = array('company_name.required' => Lang::get('oil_companies.name_require'));
     $validator = Validator::make(Input::all(), $rules, $messages);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->WithInput();
     }
     $result = OilCompany::saveCompany();
     if ($result == true) {
         return Redirect::to('oil-companies')->with('success', Lang::get('oil_companies.company_saved'));
     } else {
         return Redirect::back()->with('error', $result);
     }
 }
 public function create()
 {
     if (Input::has('_token')) {
         $model = new Cliente();
         $imagen = Input::get('imgBase64');
         Input::merge(array('imgBase64' => 'fotos/' . Input::get('dpi') . 'jpg'));
         if ($model->_create()) {
             if ($imagen != "") {
                 $this->Guardar_Foto($imagen);
             }
             return 'success';
         }
         return $model->errors();
     }
     return View::make('cliente.create');
 }
 /**
  * Update the specified resource in storage.
  * PUT /position/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     Input::merge(array_map('trim', Input::all()));
     $input = Input::all();
     $validation = Validator::make($input, Position::$rules);
     if ($validation->passes()) {
         $position = Position::find($id);
         if (is_null($position)) {
             return Redirect::route('designated-position.index')->withInput()->withErrors($validation)->with('class', 'warning')->with('message', 'Position information does not exist.');
         }
         $position->position = strtoupper(Input::get('position'));
         $position->save();
         return Redirect::route('designated-position.index')->with('class', 'success')->with('message', 'Record successfully updated.');
     } else {
         return Redirect::route('designated-position.edit', $id)->withInput()->withErrors($validation)->with('class', 'error')->with('message', 'There were validation error.');
     }
 }
 /**
  * Update the specified resource in storage.
  * PUT /role/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     Input::merge(array_map('trim', Input::all()));
     $input = Input::all();
     $validation = Validator::make($input, Role::$rules);
     if ($validation->passes()) {
         $role = Role::find($id);
         if (is_null($role)) {
             return Redirect::route('role.edit', $id)->withInput()->withErrors($validation)->with('class', 'warning')->with('message', 'Role information not exist.');
         }
         $role->name = strtoupper(Input::get('name'));
         $role->save();
         return Redirect::route('role.index')->with('class', 'success')->with('message', 'Record successfully updated.');
     } else {
         return Redirect::route('role.edit', $id)->withInput()->withErrors($validation)->with('class', 'error')->with('message', 'There were validation error.');
     }
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $data = count(\Input::all()) > 0 ? \Input::all() : \Input::json()->all();
     if (!isset($data['token'])) {
         $response = array();
         $response['return_code'] = 401;
         $response['messages'] = 'Não autorizado!';
         //Lang::get('validation.custom.hash_auth');
         return \Response::json($response, $response['return_code']);
     }
     //decrypt token
     $token = \Crypt::decrypt($data['token']);
     $data['id_users'] = $token['id_users'];
     //set Input::all parameters with id_users decrypted
     \Input::merge($data);
     return $next($request);
 }
Example #27
0
 public function testGetApi()
 {
     // Set paging to 2
     \Input::merge(array('limit' => 2));
     // Test the internal model through info
     $controller = \App::make('Tdt\\Core\\Definitions\\InfoController');
     $response = $controller->handle('');
     // The body should have only 2 entries
     $body = json_decode($response->getOriginalContent(), true);
     $this->assertEquals(count($body['datasets']), 2);
     $this->processLinkHeader($response);
     // Test the internal model through definitions
     $this->updateRequest('GET');
     $controller = \App::make('Tdt\\Core\\Definitions\\DefinitionController');
     $this->processPaging($controller->handle(''));
     // Test the internal model through dcat
     $this->processDcat();
 }
 /**
  * Update the specified resource in storage.
  * PUT /projectstatus/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     Input::merge(array_map('trim', Input::all()));
     $input_all = Input::all();
     $validation = Validator::make($input_all, Status::$update_rules);
     if ($validation->passes()) {
         $status = Status::find($id);
         if (is_null($status)) {
             return Redirect::route('project.status.index')->withInput()->withErrors($validation)->with('class', 'warning')->with('message', 'Project Status information does not exist.');
         }
         $status->status = strtoupper(Input::get('project_status'));
         $status->description = strtoupper(Input::get('description'));
         $status->save();
         return Redirect::route('project.status.index')->with('class', 'success')->with('message', 'Record successfully updated.');
     } else {
         return Redirect::route('project.status.edit', $id)->withInput()->withErrors($validation)->with('class', 'error')->with('message', 'There were validation error.');
     }
 }
Example #29
0
 public function post_edit($id)
 {
     $sponsor = Sponsor::find($id);
     $input = Input::all();
     $rules = array('name' => 'required', 'url' => 'required|url', 'image' => 'image', 'description' => 'required');
     $validation = Validator::make($input, $rules);
     if ($validation->passes()) {
         if (Input::hasFile('image')) {
             $image_name = preg_replace('/.*\\.(.+)/', $sponsor->id . ".\$1", Input::file('image')->getClientOriginalName());
             File::delete(base_path() . '/public/img/sponsor/' . $sponsor->image);
             Input::file('image')->move(base_path() . '/public/img/sponsor', $image_name);
             Input::merge(array('image' => $image_name));
         }
         $sponsor->update(Input::get());
         return Redirect::to('rms/sponsors')->with('success', 'Successfully Edited Sponsor: ' . $sponsor->name);
     } else {
         return Redirect::to('rms/sponsors/edit/' . $id)->withErrors($validation)->withInput();
     }
 }
 /**
  * Update the specified resource in storage.
  * PUT /area/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     Input::merge(array_map('trim', Input::all()));
     $input = Input::all();
     $validation = Validator::make($input, Area::$update_rules);
     if ($validation->passes()) {
         $area = Area::find($id);
         if (is_null($area)) {
             return Redirect::route('area.index')->withInput()->withErrors($validation)->with('class', 'warning')->with('message', 'Area information does not exist.');
         }
         $area->area_no = Input::get('area_number');
         $area->area_place = strtoupper(Input::get('area_place'));
         if (Area::checkif_recordexist($area)) {
             return Redirect::route('area.edit', $id)->withInput()->withErrors($validation)->with('class', 'warning')->with('message', 'Area information already exist.');
         }
         $area->save();
         return Redirect::route('area.index')->with('class', 'success')->with('message', 'Record successfully updated.');
     } else {
         return Redirect::route('area.edit', $id)->withInput()->withErrors($validation)->with('class', 'error')->with('message', 'There were validation errors.');
     }
 }