本文整理汇总了PHP中Illuminate\Support\Facades\Input::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Input::get方法的具体用法?PHP Input::get怎么用?PHP Input::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\Input
的用法示例。
在下文中一共展示了Input::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRename
/**
* @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';
}
示例2: 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]));
}
}
示例3: sendEmail
/**
* 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);
}
}
示例4: indexAction
/**
* 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);
}
示例5: materiaMaestroEnpalme
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;
}
示例6: store
/**
* 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('/');
}
}
}
示例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;
}
示例8: store
/**
* 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';
}
示例9: update
/**
* 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');
}
}
示例10: sendEnquireMail
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('info@oxoniyabuilders.com', 'Enquiry - Oxoniya')->subject('Enquiry - Oxoniya');
});
$result['status'] = 'Success';
$result['message'] = 'Contact Form Successfully Submitted';
return response()->json($result);
}
示例11: postIndex
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!');
}
}
示例12: extendedData
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;
}
示例13: validate
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);
}
}
示例14: reapply
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);
}
示例15: postOrder
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]);
}