/** * @return string */ public function getRename() { $old_name = Input::get('file'); $new_name = Input::get('new_name'); $file_path = parent::getPath('directory'); $thumb_path = parent::getPath('thumb'); $old_file = $file_path . $old_name; if (!File::isDirectory($old_file)) { $extension = File::extension($old_file); $new_name = str_replace('.' . $extension, '', $new_name) . '.' . $extension; } $new_file = $file_path . $new_name; if (File::exists($new_file)) { return Lang::get('laravel-filemanager::lfm.error-rename'); } if (File::isDirectory($old_file)) { File::move($old_file, $new_file); return 'OK'; } File::move($old_file, $new_file); if ('Images' === $this->file_type) { File::move($thumb_path . $old_name, $thumb_path . $new_name); } return 'OK'; }
public function slots() { $user = Auth::user(); $location = $user->location; $slot = Slot::where('location', '=', $location)->first(); $input = Input::get('wager'); $owner = User::where('name', '=', $slot->owner)->first(); $num1 = rand(1, 10); $num2 = rand(5, 7); $num3 = rand(5, 7); if ($user->name != $owner->name) { if ($num1 & $num2 & $num3 == 6) { $money = rand(250, 300); $payment = $money += $input * 1.75; $user->money += $payment; $user->save(); session()->flash('flash_message', 'You rolled three sixes!!'); return redirect('/home'); } else { $user->money -= $input; $user->save(); $owner->money += $input; $owner->save(); session()->flash('flash_message_important', 'You failed to roll three sixes!!'); return redirect(action('SlotsController@show', [$slot->location])); } } else { session()->flash('flash_message_important', 'You own this slot!!'); return redirect(action('SlotsController@show', [$slot->location])); } }
/** * sendEmail : Sends received email to target * * @return array : asociative array with the final status of request */ public function sendEmail() { // Recovers mail data object $mailData = json_decode(Input::get('emailData')); //Defines validator object $validator = Validator::make((array) $mailData, ['email' => array('required', 'regex:/^((<[a-z]+>)?[\\.a-zA-ZáéíóúÁÉÍÓÚñÑ_1-9]+@[a-zA-ZáéíóúÁÉÍÓÚñÑ_-]+\\.[a-zA-ZáéíóúÁÉÍÓÚñÑ]{2,12})(,((<[a-z]+>)?[\\.a-zA-ZáéíóúÁÉÍÓÚñÑ_1-9]+@[a-zA-ZáéíóúÁÉÍÓÚñÑ_-]+\\.[a-zA-ZáéíóúÁÉÍÓÚñÑ]{2,12}))*$/'), 'subject' => array('required', 'regex:/^[a-zA-ZáéíóúÁÉÍÓÚñÑ1-9][a-zA-ZáéíóúÁÉÍÓÚñÑ1-9 ]{3,50}$/')]); // Returns fail message if validation fails if ($validator->fails()) { return response()->json(['status' => 'fail'], 200); } else { // Split string of emails into an array of emails $allMails = explode(',', $mailData->email); // For each mail in $allMails, actual name and target of each mail are getted, and then the email is sent foreach ($allMails as $mail) { $separatorPosition = strpos($mail, '>'); if ($separatorPosition) { $name = substr($mail, 1, $separatorPosition - 1); $target = substr($mail, $separatorPosition + 1); } else { $target = $mail; $name = ''; } Mail::send([], [], function ($message) use($mailData, $target, $name) { $message->to($target, $name); $message->subject($mailData->subject); $message->setBody($mailData->htmlContent, 'text/html'); }); } return response()->json(['status' => 'success'], 200); } }
/** * Returns the initial HTML view for the admin interface. * * @param \Illuminate\Http\Request $request Laravel request object * @return \Illuminate\Contracts\View\View View for rendering the output */ public function indexAction(Request $request) { if (config('shop.authorize', true)) { $this->authorize('admin'); } $site = Route::input('site', 'default'); $lang = Input::get('lang', config('app.locale', 'en')); $aimeos = app('\\Aimeos\\Shop\\Base\\Aimeos')->get(); $cntlPaths = $aimeos->getCustomPaths('controller/extjs'); $context = app('\\Aimeos\\Shop\\Base\\Context')->get(false); $context = $this->setLocale($context, $site, $lang); $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); $cssFiles = array(); foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths) { foreach ($paths as $path) { $jsbAbsPath = $base . '/' . $path; if (!is_file($jsbAbsPath)) { throw new \Exception(sprintf('JSB2 file "%1$s" not found', $jsbAbsPath)); } $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($path)); $cssFiles = array_merge($cssFiles, $jsb2->getUrls('css')); } } $jqadmUrl = route('aimeos_shop_jqadm_search', array('site' => $site, 'resource' => 'product')); $jsonUrl = route('aimeos_shop_extadm_json', array('site' => $site, '_token' => csrf_token())); $adminUrl = route('aimeos_shop_extadm', array('site' => '<site>', 'lang' => '<lang>', 'tab' => '<tab>')); $vars = array('lang' => $lang, 'cssFiles' => $cssFiles, 'languages' => $this->getJsonLanguages($context), 'config' => $this->getJsonClientConfig($context), 'site' => $this->getJsonSiteItem($context, $site), 'i18nContent' => $this->getJsonClientI18n($aimeos->getI18nPaths(), $lang), 'searchSchemas' => $controller->getJsonSearchSchemas(), 'itemSchemas' => $controller->getJsonItemSchemas(), 'smd' => $controller->getJsonSmd($jsonUrl), 'urlTemplate' => str_replace(['<', '>'], ['{', '}'], urldecode($adminUrl)), 'uploaddir' => config('shop::uploaddir'), 'activeTab' => Input::get('tab', 0), 'version' => $this->getVersion(), 'jqadmurl' => $jqadmUrl); return View::make('shop::admin.extadm-index', $vars); }
public function materiaMaestroEnpalme() { $maestroId = Materia::join('maestro_materia', 'materias.id', '=', 'maestro_materia.materia_id')->where('materia_id', '=', Input::get('materia_id'))->select('materia', 'materia_id', 'maestro_id')->first(); $maestroMateria = DB::table('horarios')->join('materias', 'materias.id', '=', 'horarios.materia_id')->join('maestro_materia', 'maestro_materia.materia_id', '=', 'materias.id')->join('maestros', 'maestros.id', '=', 'maestro_materia.maestro_id')->where('hora_id', Input::get('hora_id'))->where('horarios.ciclo_id', Input::get('ciclo_id'))->where('dia_id', Input::get('dia_id'))->where('maestro_id', $maestroId->maestro_id)->get(); //dd($maestroMateria); return $maestroMateria; }
/** * Handle an authentication attempt. * * @return Response */ public function store() { $rules = array('email' => 'required|email', 'password' => 'required'); $validate = Validator::make(Input::all(), $rules); if ($validate->fails()) { return Redirect::to('/'); } else { if (Auth::attempt(array('email' => Input::get('email'), 'password' => Input::get('password'), 'status' => 'Activate'))) { /*$user = User::where('email','=',$email)->get(); Session::put('user_type',$user[0]->role); $id = $user[0]->id; Session::put('created_by',$id);*/ Session::put('user_id', Auth::user()->id); Session::put('user_name', Auth::user()->username); Session::put('user_role', Auth::user()->role); Session::flash('message', 'User has been Successfully Login.'); $roles = Auth::user()->role; if ($roles = 'admin' || 'manager') { return Redirect::to('dashboard'); } elseif ($roles = 'user') { return Redirect::to('profile'); } } else { Session::flash('message', 'Your username or password incorrect'); return Redirect::to('/'); } } }
public function search(Request $request) { $this->validate($request, ['str' => 'required']); $keyword = Input::get('str'); $songs = Song::where('song_name', 'like', "%{$keyword}%")->orderBy('song_id', 'desc')->limit(15)->get(); return $songs; }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $user = Auth::user(); $pusher = new Pusher(Config::get('services.pusher.key'), Config::get('services.pusher.secret'), Config::get('services.pusher.id')); $pusher->trigger('my-channel', 'my-event', array('message' => $user->name . ': ' . Input::get('msg'), 'user_id' => $user->id)); return 'done'; }
/** * Update the specified resource in storage. * * @param Request $request * @param int $id * @return Response */ public function update(Request $request, $id) { // // 先验证 $this->validate($request, ['title' => 'required', 'content' => 'required']); // $wdInfo = WdInfo::findOrFail($id); $wdInfo->title = Input::get('title'); $wdInfo->content = Input::get('content'); // 单独处理图片 $newLogo = ImageUtil::saveImgFromRequest($request, 'logo', 'img/wd/'); if (!is_null($newLogo)) { $wdInfo->logo = $newLogo; } $newQr = ImageUtil::saveImgFromRequest($request, 'qrImg', 'img/wd/'); if (!is_null($newQr)) { $wdInfo->qr_img = $newQr; } if ($wdInfo->save()) { // return redirect($request->getPathInfo(). '/edit')->withData([ // 'wdInfo' => $wdInfo, // 'message' => [trans('adminTip.wdInfo.editInfo.success.edit')] // ]); return redirect($request->getPathInfo() . '/edit')->withInput()->withOk(trans('adminTip.wdInfo.editInfo.success.edit')); } else { return Redirect::back()->withInput()->withErrors('error'); } }
public function sendEnquireMail() { $name = Input::get('name'); $email = Input::get('email'); $mobile = Input::get('mobile'); $message2 = Input::get('message'); $result = array(); $validation = $validator = Validator::make(array('Name' => $name, 'email' => $email, 'Mobile' => $mobile, 'Message' => $message2), array('Name' => 'required', 'email' => 'required|email', 'Mobile' => 'required|numeric', 'Message' => 'required')); if ($validation->fails()) { $result['status'] = 'Failure'; $result['message'] = 'Fill all fields with valid values'; return response()->json($result); } $data['name'] = $name; $data['email'] = $email; $data['mobile'] = $mobile; $data['message2'] = $message2; Mail::send('mail.enquire', $data, function ($message1) use($data) { $message1->from($data['email'], $data['name']); $message1->to('*****@*****.**', 'Enquiry - Oxoniya')->subject('Enquiry - Oxoniya'); }); $result['status'] = 'Success'; $result['message'] = 'Contact Form Successfully Submitted'; return response()->json($result); }
public function postIndex() { $imagem = Input::file('imagem'); if (is_null($imagem)) { throw new Exception('Você não selecionou um arquivo'); } $destinationPath = public_path() . DIRECTORY_SEPARATOR . 'uploads'; $filename = date('YmdHis') . '_' . $imagem->getClientOriginalName(); if ($imagem->move($destinationPath, $filename)) { //Load view laravel paths $paths = Config::get('view.paths'); //Load file view $file = $paths[0] . DIRECTORY_SEPARATOR . Input::get('view') . '.blade.php'; $html = file_get_contents($file); //Init crawler $crawler = new HtmlPageCrawler($html); //Set filter $filter = '#' . Input::get('id'); //Edit node $crawler->filter($filter)->setAttribute('src', '/uploads/' . $filename); $newHTML = html_entity_decode($crawler->saveHTML()); $newHTML = str_replace('%7B%7B', '{{', $newHTML); $newHTML = str_replace('%7D%7D', '}}', $newHTML); $newHTML = str_replace('%24', '$', $newHTML); $newHTML = str_replace('%20', ' ', $newHTML); $newHTML = str_replace('%7C', '|', $newHTML); //write file file_put_contents($file, $newHTML); return Redirect::back()->with('alert', 'Banner enviado com sucesso!'); } }
public function extendedData($data, $level = 0) { /* Extended param exist */ if (Input::get('extended') != "true" && Input::get('extended') != "1") { return $data; } /* Try extend main data */ if (method_exists($data, 'extended')) { $data->extended(); } /* If not array, return data*/ if (is_array($data) || method_exists($data, 'toArray')) { /* Try extend others objects */ foreach ($data as $key => $value) { if (method_exists($value, 'extended')) { $value->extended(); } if ($this->extended_max_depht > $level) { $this->extendedData($value, $level + 1); } } } /* return final data */ return $data; }
public function validate() { $json = json_decode(file_get_contents($this->verifyURL . '?secret=' . $this->private_key . '&response=' . Input::get('g-recaptcha-response')), true); if ($json["success"] == false) { throw new RecaptchaException($this->errorMessage); } }
public function reapply() { $auth_token = Request::header('Authorization'); $user = User::where('auth_token', '=', $auth_token)->first(); if ($user) { $period_id = Input::get('period_id'); if ($period_id) { $entry = UsersPeriodo::getUsersPeriodoByUserXPeriodo($user->id, $period_id)->first(); if (!$entry) { $users_periodo = new UsersPeriodo(); $users_periodo->idusers = $user->id; $users_periodo->idperiodos = $period_id; $users_periodo->save(); $response = ['success' => 1]; $status_code = 200; return Response::json($response, $status_code); } else { $response = ['error' => 'El voluntario ya está registrado en el próximo período.']; $status_code = 200; return Response::json($response, $status_code); } } else { $response = ['error' => 'Error en parámetros.']; $status_code = 404; return Response::json($response, $status_code); } } $response = ['error' => 'Error en la autenticación.']; $status_code = 401; return Response::json($response, $status_code); }
public function postOrder() { log::debug('postOrder::Input params'); log::debug(Input::all()); //Validation rules $rules = array('pizza_marinara' => array('required', 'integer', 'between:0,3'), 'pizza_margherita' => array('required', 'integer', 'between:0,3'), 'olio' => array('min:1|max:20'), 'name' => array('required', 'min:1|max:20'), 'email' => array('required', 'email', 'min:1|max:20'), 'freeOrder' => array('exists:menu,dish')); // The validator $validation = Validator::make(Input::all(), $rules); // Check for fails if ($validation->fails()) { // Validation has failed. log::error('Validation has failed'); $messages = $validation->messages(); $returnedMsg = ""; foreach ($messages->all() as $message) { $returnedMsg = $returnedMsg . " - " . $message; } log::error('Validation fail reason: ' . $returnedMsg); return redirect()->back()->withErrors($validation); } log::debug('Validation passed'); $msg = array('email' => Input::get('email'), 'name' => Input::get('name')); $response = Event::fire(new ExampleEvent($msg)); $response = Event::fire(new OrderCreated($msg)); return view('orderdone', ['msg' => $msg]); }
/** * Show the application dashboard to the user. * * @return Response */ public function ListaPagos() { $alumno_mensualidad = Input::get('alumno_mensualidad'); $apellido_mensualidad = Input::get('apellido_mensualidad'); $data = PagoMensualidad::with('mensualidad'); if ($alumno_mensualidad != '') { $data = $data->join('mensualidad as m', 'pago_mensualidad.mensualidad_id', '=', 'm.id')->join('users as u', 'm.user_id', '=', 'u.id')->where('u.name', $alumno_mensualidad); } if ($apellido_mensualidad != '') { $data = $data->join('mensualidad as m', 'pago_mensualidad.mensualidad_id', '=', 'm.id')->join('users as u', 'm.user_id', '=', 'u.id')->where('u.last_name', $apellido_mensualidad); } $filter = DataFilter::source($data); $filter->attributes(array('class' => 'form-inline')); $filter->add('fecha_pago', 'Fecha Pago', 'daterange')->format('d/m/Y', 'es'); $filter->submit('Buscar'); $filter->reset('Limpiar'); $filter->build(); $grid = DataGrid::source($filter); $grid->attributes(array("class" => "table table-striped")); $grid->add('mensualidad.alumno.fullname', 'Nombre'); $grid->add('mensualidad.alumno.email', 'Email'); $grid->add('mensualidad.plan.nombre', 'Plan'); $grid->add('fecha_pago|strtotime|date[d/m/Y]', 'Fecha', true); $grid->add('monto', 'Monto', true); $grid->add('tipo_pago', 'Tipo Pago', true); $grid->add('observacion', 'Observación', true); $grid->add('{!! ("<a class=text-info title=Delete href=/pago_mensualidad/$mensualidad_id/edit?modify=$id><span class=\\"glyphicon glyphicon-edit\\"> </span></a> <a class=text-danger title=Delete href=/pago_mensualidad/$mensualidad_id/edit?delete=$id><span class=\\"glyphicon glyphicon-trash\\"> </span></a> ") !!}', 'Borrar'); $grid->orderBy('pago_mensualidad.id', 'desc'); $grid->paginate(10); return view('pagos/lista', compact('filter', 'grid')); }
public function updateIndex($membershipUid) { $projectMembership = ProjectMembership::where('membership_uid', '=', $membershipUid)->get()->first(); $projectMembership->admin_flag = Input::get('admin_flag'); $projectMembership->save(); return $projectMembership; }
public function generate() { $input = Input::get('number'); $birthday = Input::get('bd'); $location = Input::get('l'); if (!ctype_digit($input)) { return Redirect::back()->with('message', 'You did not enter a number!'); } $input = intval($input); if ($input < 0 || $input > 99) { return Redirect::back()->with('message', 'You have to enter number between 1 to 99!'); } $faker = \Faker\Factory::create(); $users = array(); for ($i = 0; $i < $input; $i++) { if (is_null($birthday) && is_null($location)) { $users[$i] = "<p>" . $faker->userName . "</p>"; } elseif (isset($birthday) && !isset($location)) { $users[$i] = "<p>" . $faker->userName . "</br>" . $faker->dateTimeThisCentury->format('Y-m-d') . "</p>"; } elseif (!isset($birthday) && isset($location)) { $users[$i] = $faker->userName . "</br>" . $faker->city; } else { $users[$i] = "<p>" . $faker->userName . "</br>" . $faker->dateTimeThisCentury->format('Y-m-d') . "</br>" . $faker->city . "</p>"; } } $generated = implode('<br>', $users); return view('randomuser')->with('generated', $generated); }
public function sender($id) { $order = Order::where('id', '=', $id)->where('user_id', '=', Auth::user()->id)->first(); $order->sender_city_id = (int) Input::get("sender_city_id"); $this->recalculateDelivery($order); return $this->orderToJson($order); }
public function postRegister(Request $request) { $validator = $this->registrar->validator($request->all()); if ($validator->fails()) { $this->throwValidationException($request, $validator); } $this->auth->login($this->registrar->create($request->all())); $id = DB::getPdo()->lastInsertId(); $user = \Auth::user(); if (Input::get('state') === 'company') { $user->isCompany = 1; $user->save(); return Redirect('company/project'); } else { if (Input::get('state') === 'student') { $user->isStudent = True; $user->save(); return Redirect('profile'); } else { if (Input::get('state') === 'expertise') { $user->isExpertise = True; $user->save(); return Redirect('profile'); } } } }
public function store(PostRequest $request) { if (Input::has('link')) { $input['link'] = Input::get('link'); $info = Embed::create($input['link']); if ($info->image == null) { $embed_data = ['text' => $info->description]; } else { if ($info->description == null) { $embed_data = ['text' => '']; } else { $orig = pathinfo($info->image, PATHINFO_EXTENSION); $qmark = str_contains($orig, '?'); if ($qmark == false) { $extension = $orig; } else { $extension = substr($orig, 0, strpos($orig, '?')); } $newName = public_path() . '/images/' . str_random(8) . ".{$extension}"; if (File::exists($newName)) { $imageToken = substr(sha1(mt_rand()), 0, 5); $newName = public_path() . '/images/' . str_random(8) . '-' . $imageToken . ".{$extension}"; } $image = Image::make($info->image)->fit(70, 70)->save($newName); $embed_data = ['text' => $info->description, 'image' => basename($newName)]; } } Auth::user()->posts()->create(array_merge($request->all(), $embed_data)); return redirect('/subreddit'); } Auth::user()->posts()->create($request->all()); return redirect('/subreddit'); }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { $a = new \App\Popups(); $a->judul = Input::get('judul'); $a->slug = str_slug(Input::get('judul')); $a->deskripsi = Input::get('keterangan'); $a->tipe_valid = Input::get('type_valid'); if ($a->tipe_valid == "by_datetime" or $a->tipe_valid == "by_date") { $a->date_valid_start = date_format(date_create(Input::get('date_valid_start')), "Y-m-d"); $a->date_valid_end = date_format(date_create(Input::get('date_valid_end')), "Y-m-d"); } if ($a->tipe_valid == "by_datetime" or $a->tipe_valid == "by_time") { $a->time_valid_start = date_format(date_create(Input::get('time_valid_start')), "H:i:s"); $a->time_valid_end = date_format(date_create(Input::get('time_valid_end')), "H:i:s"); } if (Input::hasFile('image') and Input::file('image')->isValid()) { $image = date("YmdHis") . uniqid() . "." . Input::file('image')->getClientOriginalExtension(); Input::file('image')->move(storage_path() . '/popup_image', $image); $a->image = $image; } $a->keep_open = Input::get('keep_open'); $a->hotlink = Input::get('hotlink'); $a->idpengguna = Auth::user()->id; $a->save(); return redirect(url('admin/popups')); }
/** * 验证方法 * @throws \HttpRequestException */ public function validate() { foreach ($this->getKform()->getFormFields() as $formField) { if ($formField instanceof FormField) { $formField->setValue(Input::get($formField->getFieldName()), $this); } } if (!$this->getKform()->isPassed()) { $errors = $this->getKform()->getErrors(); if ($this->ajax() || $this->wantsJson()) { $response = new APIJsonResponse(); $error = new FailedValidtionError(); $error->setErrorContext($errors); $response->pushError($error); throw new HttpResponseException($response->getResponse()); } else { $messenger = new KMessenger(); foreach ($this->getKform()->getFormFields() as $formField) { foreach ($formField->getErrors() as $error) { $messenger->push($error, KMessenger::ERROR); } } $view = $this->directlyErrorView(); if ($view instanceof View) { $response = \Response::make($view); } else { $response = $this->redirectBackResponse(); } throw new HttpResponseException($response); } } }
public function delete() { $id = Input::get('id'); $this->model = Terrain::find($id); $this->model->delete(); return Response::json(['success' => true]); }
public function facebookLogin(Request $request) { $fb = new Facebook(); // если код не предоставлен if (Input::get('code') === null) { return Redirect::to('http://what-it-means.ru/#/site/auth/facebook/error/rejected-by-user'); } // если код предоставлен, но он не верен (кто то вмешался по середине) $authResult = $fb->auth(Input::get('code')); if (!$authResult) { return Redirect::to('http://what-it-means.ru/#/site/auth/facebook/error/auth-error'); } // если все в порядке, выполним нужные нам действия (авторизация, регистрация) $fbUserData = $fb->api('/me'); // нужно ли зарегистрировать пользователя или авторизовать? if (isset($fbUserData->email)) { $user = User::findByEmail($fbUserData->email); if (!$user) { $user = User::create(array('name' => $fbUserData->name, 'email' => $fbUserData->email, 'password' => md5(Func::hash(8)))); } Auth::login($user, true); return Redirect::to('http://what-it-means.ru/#/site/auth/facebook/success/'); } //echo var_dump($fbUserData); // нужно ли только авторизовать пользователя даже если емейл не предоставлен? $userSocGlueData = UserSocGlue::where(['provider' => 'facebook', 'provider_user_id' => $fbUserData->id])->first(); if ($userSocGlueData) { Auth::login(User::find($userSocGlueData->user_id), true); return Redirect::to('http://what-it-means.ru/#/site/auth/facebook/success/'); } // если не хватает данных о юзере и он не зарегистрирован if (!isset($fbUserData->email)) { return Redirect::to('http://what-it-means.ru/#/site/auth/facebook/error/no-email'); } }
public function postReceive() { $code = Input::get('code'); if ($code) { $coupon = AdminCoupon::where(['coupon_code' => $code])->first(); if ($coupon) { $data = []; $data['coupon_id'] = $coupon->id; $data['user_id'] = Session::get('uid'); $data['is_used'] = 0; $isCoupon = PhoneUserToCoupon::where($data)->first(); if ($isCoupon) { flash('亲,您已经领取过这个红包啦~'); return redirect()->back(); } $couponToUser = new PhoneUserToCoupon(); $couponToUser->coupon_id = $coupon->id; $couponToUser->user_id = Session::get('uid'); if ($couponToUser->save()) { $coupon->used += 1; $coupon->save(); return redirect("coupon/success/{$coupon->coupon_price}"); } else { flash('亲~现在服务器压力山大~请稍后再试'); return redirect()->back(); } } else { flash('亲~兑换码不对呦~请重试'); return redirect()->back(); } } else { flash('亲~兑换码不能为空哦~请重试'); return redirect()->back(); } }
/** * This method is called when a post request is received from the * corresponding page. The method checks which component was triggered and * calls the corresponding method * @param Request $request * @return view */ public function postButton(Request $request) { if (Input::get('save_comp')) { $this->competenceForm($request); return view('application_form'); } elseif (Input::get('save_period')) { $this->periodForm($request); return view('application_form'); } elseif (Input::get('submit')) { $this->submitForm(); return view('submit_success'); } elseif (Input::get('cancel')) { $this->cancelForm(); return view('application_form'); } elseif (Input::get('en')) { App::setLocale('en'); Session::put('application_locale', 'en'); $this->changeLanguage('en'); return view('application_form'); } elseif (Input::get('sv')) { App::setLocale('sv'); Session::put('application_locale', 'sv'); $this->changeLanguage('sv'); return view('application_form'); } elseif (Input::get('tr')) { App::setLocale('tr'); Session::put('application_locale', 'tr'); $this->changeLanguage('tr'); return view('application_form'); } }
/** * Returns HTML markup for search results in users search form. * * @return \Illuminate\View\View */ public function search() { $input = Input::get('input'); // Populates search results of users with first and last names similar to user input. $user_results = User::where('first_name', 'LIKE', '%' . $input . '%')->orWhere('last_name', 'LIKE', '%' . $input . '%')->get(); return view('search.users', compact('user_results')); }
/** * Traitement du formulaire de validation * * @return Redirect */ public function postEntrepriseValidation(ValidationEntrepriseRequest $request) { $user = User::find(Input::get('_id')); $user->valide = 1; $user->save(); return Redirect::refresh()->with('flash_success', 'L\'entreprise a bien été validée'); }
public function location($locId = 0) { if ($locId) { return Location::findOrFail($locId); } return Location::where('name', 'LIKE', Input::get('q') . '%')->orderBy('name')->groupBy(['name', 'country'])->get(); }