当前位置: 首页>>代码示例>>PHP>>正文


PHP Facades\Input类代码示例

本文整理汇总了PHP中Illuminate\Support\Facades\Input的典型用法代码示例。如果您正苦于以下问题:PHP Input类的具体用法?PHP Input怎么用?PHP Input使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Input类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: slots

 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]));
     }
 }
开发者ID:mathewsandi,项目名称:MafiaGame,代码行数:31,代码来源:SlotsController.php

示例2: duzenleForm

 public function duzenleForm($id)
 {
     $data = Input::all();
     $kural = array('baslik' => 'required|min:3', 'resim' => 'max:1536|required|mimes:jpeg,jpg,bmp,png,gif');
     $dogrulama = \Validator::Make($data, $kural);
     if (!$dogrulama->passes()) {
         return \Redirect::to('admin/galeriler/duzenle/' . $id)->withErrors($dogrulama)->withInput();
     } else {
         if (Input::hasFile('resim')) {
             $dosya = Input::file('resim');
             $uzanti = $dosya->getClientOriginalExtension();
             if (strlen($uzanti) == 3) {
                 $dosyaAdi = substr($dosya->getClientOriginalName(), 0, -4);
             } else {
                 if (strlen($uzanti) == 4) {
                     $dosyaAdi = substr($dosya->getClientOriginalName(), 0, -5);
                 }
             }
             $dosyaAdi = $dosyaAdi . "_" . date('YmdHis') . '.' . $uzanti;
             $path = base_path('galeriResimler/600x450/' . $dosyaAdi);
             Image::make($dosya->getRealPath())->resize(600, 450)->save($path);
             $path = base_path('galeriResimler/defaultSize/' . $dosyaAdi);
             Image::make($dosya->getRealPath())->save($path);
             $path = $dosyaAdi;
             $query = DB::insert('insert into gal_resim values (null,?,?,?)', array($id, $data["baslik"], $path));
             return Redirect::back();
         }
     }
 }
开发者ID:hakanozer,项目名称:laravelAdmin,代码行数:29,代码来源:galerilerController.php

示例3: update

 public function update()
 {
     $profile = Profile::where('user_id', Auth::user()->id)->first();
     $profile->fill(Input::all());
     $profile->save();
     return Redirect::to("/edit_profile");
 }
开发者ID:Volkan61,项目名称:begreat,代码行数:7,代码来源:ProfileController.php

示例4: facebookLogin

 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');
     }
 }
开发者ID:pavvell,项目名称:open-language,代码行数:35,代码来源:oAuthController.php

示例5: validate

 /**
  * 验证方法
  * @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);
         }
     }
 }
开发者ID:xjtuwangke,项目名称:laravel-bundles,代码行数:36,代码来源:KFormRequest.php

示例6: store

 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');
 }
开发者ID:ReyRodriguez,项目名称:laravel-reddit,代码行数:33,代码来源:PostsController.php

示例7: search

 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;
 }
开发者ID:herro-chen,项目名称:catcatfm,代码行数:7,代码来源:SongController.php

示例8: upload

 public function upload()
 {
     $userName = Auth::user()->id;
     if (Input::hasFile('rnaVcfFile')) {
         $fileRNA = Input::file('rnaVcfFile');
         if ($fileRNA->isValid()) {
             /*$clientName = $file->getClientOriginalName();
               $tmpName = $file->getFileName();
               $realPath = $file->getRealPath();
               $entension = $file->getClientOriginalExtension();
               $mimeType = $file->getMimeType();*/
             $newName = $userName . '_rna.vcf';
             /*$path = */
             $fileRNA->move('../storage/vcf_file', $newName);
             redirect('/');
         }
     } elseif (Input::hasFile('dnaVcfFile')) {
         $fileDNA = Input::file('dnaVcfFile');
         if ($fileDNA->isValid()) {
             $newName = $userName . '_dna.vcf';
             /*$path = */
             $fileDNA->move('../storage/vcf_file', $newName);
             redirect('/');
         }
     }
 }
开发者ID:Taruca,项目名称:REDetector,代码行数:26,代码来源:HomeController.php

示例9: store

 /**
  * 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'));
 }
开发者ID:ariefsetya,项目名称:it-club,代码行数:31,代码来源:PopupsController.php

示例10: postRegister

 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');
             }
         }
     }
 }
开发者ID:michaelotto126,项目名称:shokes,代码行数:27,代码来源:AuthController.php

示例11: generate

 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);
 }
开发者ID:jtrupina,项目名称:DevelopersBestFriend,代码行数:28,代码来源:RandomUserController.php

示例12: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store()
 {
     $advBuss = new AdvertiserBusiness();
     $data = Input::all();
     $validator = $this->checkValidation();
     if ($validator->fails()) {
         $messages = $validator->messages();
         foreach ($messages->all() as $message) {
             $msg[] = $message;
         }
         return $this->errorMessage($msg);
     }
     $img_hash1 = $advBuss->imageUpload($data['img_hash1'], $this->uploaddir);
     if (isset($img_hash1) and !empty($img_hash1)) {
         $data['img_hash1'] = $img_hash1;
     }
     $img_hash2 = $advBuss->imageUpload($data['img_hash2'], $this->uploaddir);
     if (isset($img_hash2) and !empty($img_hash2)) {
         $data['img_hash2'] = $img_hash2;
     }
     $img_hash3 = $advBuss->imageUpload($data['img_hash3'], $this->uploaddir);
     if (isset($img_hash3) and !empty($img_hash3)) {
         $data['img_hash3'] = $img_hash3;
     }
     $userDetail = $advBuss->getDetailByUserId($data['user_id']);
     if (empty($userDetail)) {
         $advertiserProfile = $advBuss->insert($data);
         $msg[] = "Profile saved successfully.";
         return $this->successMessageWithVar($msg, $advertiserProfile);
     } else {
         $advertiserProfile = $advBuss->updateData($data);
         $msg[] = "Profile updated successfully.";
         return $this->successMessageWithVar($msg, $advertiserProfile);
     }
 }
开发者ID:aginotra,项目名称:adv,代码行数:41,代码来源:AdvertiserBussController.php

示例13: execute

 /**
  * Execute the command
  *
  * @param  string $command
  * @param  array|null $input
  * @param  string|array $decorators
  * @return mixed
  */
 public function execute($command, $input = null, $decorators = [])
 {
     $input = $input ?: Input::all();
     $command = $this->mapInputToCommand($command, (array) $input);
     $bus = $this->getCommandBus();
     return $bus->before($decorators)->execute($command);
 }
开发者ID:bruno-barros,项目名称:w.eloquent-bus,代码行数:15,代码来源:CommanderTrait.php

示例14: ListaPagos

 /**
  * 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'));
 }
开发者ID:davila7,项目名称:kayra,代码行数:38,代码来源:PagosController.php

示例15: delete

 public function delete()
 {
     $id = Input::get('id');
     $this->model = Terrain::find($id);
     $this->model->delete();
     return Response::json(['success' => true]);
 }
开发者ID:binaryk,项目名称:pedia,代码行数:7,代码来源:PreTerrainController.php


注:本文中的Illuminate\Support\Facades\Input类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。