本文整理汇总了PHP中Illuminate\Support\Facades\Request::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::get方法的具体用法?PHP Request::get怎么用?PHP Request::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\Request
的用法示例。
在下文中一共展示了Request::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* @param array $parameters
*
* @return string
*/
public static function render(array $parameters)
{
list($sortColumn, $sortParameter, $title, $queryParameters) = self::parseParameters($parameters);
$title = self::applyFormatting($title);
$icon = Config::get('columnsortable.default_icon_set');
foreach (Config::get('columnsortable.columns') as $value) {
if (in_array($sortColumn, $value['rows'])) {
$icon = $value['class'];
}
}
if (Request::get('sort') == $sortParameter && in_array(Request::get('order'), ['asc', 'desc'])) {
$icon .= Request::get('order') === 'asc' ? Config::get('columnsortable.asc_suffix', '-asc') : Config::get('columnsortable.desc_suffix', '-desc');
$direction = Request::get('order') === 'desc' ? 'asc' : 'desc';
} else {
$icon = Config::get('columnsortable.sortable_icon');
$direction = Config::get('columnsortable.default_direction_unsorted', 'asc');
}
$iconAndTextSeparator = Config::get('columnsortable.icon_text_separator', '');
$clickableIcon = Config::get('columnsortable.clickable_icon', false);
$trailingTag = $iconAndTextSeparator . '<i class="' . $icon . '"></i>' . '</a>';
if ($clickableIcon === false) {
$trailingTag = '</a>' . $iconAndTextSeparator . '<i class="' . $icon . '"></i>';
}
$anchorClass = self::getAnchorClass();
$queryString = http_build_query(array_merge($queryParameters, array_filter(Request::except('sort', 'order', 'page')), ['sort' => $sortParameter, 'order' => $direction]));
return '<a' . $anchorClass . ' href="' . url(Request::path() . '?' . $queryString) . '"' . '>' . htmlentities($title) . $trailingTag;
}
示例2: createUsers
public function createUsers()
{
$inputs = Request::all();
$userTypes = Request::get('userType');
// Checking permission of user before creating new users
$emails = json_decode(Request::input('users'));
foreach ($emails as $email) {
Log::info('username - ' . $email);
$password = str_random(10);
DB::table('users')->insert(['name' => $email, 'email' => $email, 'password' => bcrypt($password), 'type' => 'caller']);
foreach ($userTypes as $userType) {
// Making a 'userType' user
$user = \App\User::where('name', '=', $email)->first();
$caller = \App\Role::where('name', '=', $userType)->first();
// role attach alias
$user->attachRole($caller);
// parameter can be an Role object, array, or id
}
$data = array('name' => $email, 'username' => $email, 'password' => $password);
// Would sent a link to the user to activate his account
// $this->sendLink($email);
// \Mail::send('mail.email', $data, function ($message) use ($data) {
// $message->subject('Login Details ')
// ->to('manish.dwibedy@gmail.com');
// });
}
return view('create-users', ['page' => 'create-users']);
}
示例3: anyIndex
public function anyIndex()
{
//获取路由传入的参数
//echo Route::input('name');
//获取配置信息
$value = config('app.timezone');
//var_dump($value);
//获取请求输入 http://host-8/web/user?name=dfse 输出:dfse
$name1 = Request::has('name') ? Request::get('name') : '';
//取得特定输入数据,若没有则取得默认值
$name2 = Request::input('name', '默认值');
$input = Request::all();
//所有的
$input = Request::input('products.0.name');
//重定向
//return redirect('login');
//获取cookie
$value = Request::cookie('name');
//获取域名
$url = Request::root();
// echo $url;
$data = ['url' => $url, 'name1' => $name1, 'name2' => $name2, 'value' => $value];
//响应视图 响应最常用的几个方法:make/view/json/download/redirectTo
return response()->view('user.user', $data);
}
示例4: getProgrammes
/**
* Get a collection of programmes listed by letter, using a cached record if it exists
* @param string $letter The letter for which to query the programmes
* @return \Illuminate\Support\Collection
*/
public function getProgrammes($letter)
{
$page = Request::get('page', 1);
return $this->cache->remember("bbc.programmes.{$letter}.page.{$page}", \Config::get('cache.remember_time'), function () use($letter) {
return $this->bbc_api_client->getProgrammes($letter);
});
}
示例5: CitiesAutocomplete
function CitiesAutocomplete()
{
Request::setMethod('GET');
$stateCode = Request::get('stateCode', "");
$stateCode = filter_var($stateCode, FILTER_SANITIZE_STRING);
$cityName = Request::get('cityName', "");
$cityName = filter_var($cityName, FILTER_SANITIZE_STRING);
//
$cityResult = [];
if ("" != $cityName) {
$cities = DB::table('cache_gulliver_states')->select('cities')->where('code', $stateCode)->get();
$cities = json_decode($cities[0]->cities);
foreach ($cities as $city) {
if ($city->name == $cityName) {
$cityResult = $city;
break;
}
}
return Response::json($cityResult, 200);
} else {
$cities = DB::table('cache_gulliver_states')->select('cities')->where('code', $stateCode)->get();
if (true == empty($cities[0]->cities)) {
$cities = Gulliver::getCities('AR', $stateCode);
DB::table('cache_gulliver_states')->where('code', $stateCode)->update(['cities' => json_encode($cities)]);
} else {
$cities = json_decode($cities[0]->cities);
}
return Response::json($cities, 200);
}
}
示例6: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(LoginAndRegisterFormRequest $request)
{
if (Request::isMethod('post')) {
User::create(['name' => Request::get('name'), 'email' => Request::get('email'), 'password' => bcrypt(Request::get('password'))]);
}
return Redirect::to('/auth/login')->with('successfullyRegistered', 'Konto utworzone. Zaloguj się.');
}
示例7: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$inputs = Request::all();
$reglas = array('nombre' => 'required', 'correo' => 'email', 'comentarios' => 'required|max:300');
$mensajes = array('required' => trans('error.requerido'), 'email' => trans('error.correo'));
$validar = Validator::make($inputs, $reglas, $mensajes);
if ($validar->fails()) {
//return back('#gracias')->withErrors($validar)->withInput();
return Redirect::to(\LaravelLocalization::getCurrentLocale() . '/' . trans('menu.contacto') . '#about')->withErrors($validar)->withInput();
} else {
$contacto = new Contacto();
$contacto->email = Request::get('correo');
$contacto->save();
$contactName = Request::get('nombre');
$contactEmail = Request::get('correo');
$contactMessage = Request::get('comentarios');
$contactAddres = Request::get('direccion');
$data = array('name' => $contactName, 'email' => $contactEmail, 'description' => $contactMessage, 'addres' => $contactAddres);
Mail::send('layouts.email', $data, function ($message) use($contactEmail, $contactName) {
$message->from($contactEmail, $contactName);
$message->to('contacto@fundacionvivemejor.org', 'Contacto Fundacion Vive Mejor')->subject('Solicitud vía WEB');
$message->cc($contactEmail, $contactName);
});
return Redirect::to(\LaravelLocalization::getCurrentLocale() . '/' . trans('menu.contacto') . '?gracias#gracias');
}
}
示例8: finalizeTransaction
public function finalizeTransaction(TierDescriptor $tiers, TransactionRepository $transactions, TransactionResultListener $resultListener)
{
$txId = Request::get("tx");
// $st = Request::get('st');
// $amt = Request::get('amt');
$r = $this->callPayPalAPI($this->formUrl(), ["cmd" => "_notify-synch", "tx" => $txId, "at" => $this->pdtToken(), "submit" => "PDT"]);
if ($r[0] == "SUCCESS") {
$status = "success";
} else {
$status = $r[0];
}
$buyerId = Auth::user()->getAuthIdentifier();
$money = $r['mc_gross'];
$product = array_get($r, 'custom', 'free');
$tierPrice = floatval($tiers->getTierPrice($product));
if ($tierPrice > floatval($money)) {
return $resultListener->transactionFail(null, sprintf(_("You did not pay the full amount of the price for the item! (For further information, the transaction id is %s)"), $txId));
}
$extra = json_encode($r);
$tx = new PaypalTransaction($txId, $status, $buyerId, $money, $product, $extra);
if ($tx->getStatus() == "success") {
$transactions->saveOrUpdateTransaction($tx);
return $resultListener->transactionOk($tx);
} else {
return $resultListener->transactionFail($tx, sprintf(_("The transaction did not commit. The current status is %s"), $tx->getStatus()));
}
}
示例9: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
$params = Request::get('_form');
$photo = "";
$name = $params['name'];
$surname = $params['surname'];
$address = $params['address'];
$photo = $params['image'];
$contact = Contacts::find($id);
$contact->name = $name;
$contact->surname = $surname;
$contact->address = $address;
if ($photo != "") {
$contact->photo = $photo;
}
//creo i numeri telefonici associati
$numbers = $params['numbers'];
$contact->numbers()->delete();
foreach ($numbers as $number) {
$new_number = Numbers::firstOrCreate(['number' => $number, 'contact_id' => $contact->id]);
$contact->numbers()->save($new_number);
}
$contact->save();
return response()->json(array('id' => $contact->id, 'name' => $contact->name, 'surname' => $contact->surname, 'photo' => $contact->photo));
}
示例10: showForumAction
public function showForumAction()
{
if (Request::has('id')) {
if (!Request::has('page_number')) {
$page_number = 1;
} else {
$page_number = Request::get('page_number');
}
$parent = Page::where('id', '=', Request::input('id'))->first();
if ($parent->is_sheet) {
$messages = ForumPageMessage::where('page_id', '=', $parent->id)->take(3)->skip(($page_number - 1) * 3)->get();
$users = User::all();
$page_title = $parent->title;
$messages_count = ForumPageMessage::where('page_id', '=', $parent->id)->count();
return view('base.forum_page', ['messages' => $messages, 'page_id' => Request::input('id'), 'users' => $users, 'page_title' => $page_title, 'page_number' => $page_number, 'messages_count' => $messages_count]);
}
$childs = Page::where('parent_id', '=', $parent->id)->get();
} else {
$parent = Page::where('title', '=', 'Форум')->first();
$childs = Page::where('parent_id', '=', $parent->id)->get();
}
$child_messages = null;
foreach ($childs as $child) {
if ($child->is_sheet) {
$child_messages[] = ForumPageMessage::where('page_id', '=', $child->id)->get();
}
}
return view('base.forum', ['topics' => $childs, 'parent_page' => $parent, 'page_messages' => $child_messages]);
}
示例11: _captureReportFields
private function _captureReportFields()
{
$fields['report_level_id'] = Request::get('report_level_id');
$fields['report_type_id'] = Request::get('report_type_id');
switch ($fields['report_type_id']) {
case ReportType::CUSTOM:
$fields['view_mode'] = "days";
$fields['format'] = "DD/MM/YYYY";
$fields['start_date'] = $this->_parseDate(Request::get('start_date'))->format('d/m/Y');
$fields['end_date'] = $this->_parseDate(Request::get('end_date'))->format('d/m/Y');
break;
case ReportType::YEARLY:
$fields['view_mode'] = "years";
$fields['format'] = "YYYY";
$fields['start_date'] = $this->_parseDate(Request::get('start_date'))->format('Y');
break;
case ReportType::MONTHLY:
$fields['view_mode'] = "months";
$fields['format'] = "MM/YYYY";
$fields['start_date'] = $this->_parseDate(Request::get('start_date'))->format('m/Y');
break;
case ReportType::DAILY:
default:
$fields['view_mode'] = "days";
$fields['format'] = "DD/MM/YYYY";
$fields['start_date'] = $this->_parseDate(Request::get('start_date'))->format('d/m/Y');
break;
}
return $fields;
}
示例12: afterRegistered
public function afterRegistered()
{
$this->response = lego_register(ResponseData::class, function () {
$items = call_user_func_array($this->data(), [Request::get(self::KEYWORD_KEY), Request::all()]);
return self::result($items);
}, $this->name);
}
示例13: getPublications
public function getPublications()
{
$post = Post::status(Request::get('filter'))->orderBy('updated_at', 'DESC')->paginate(20)->appends(Request::only(['filter']));
$tmp = array('extends' => Config::get('social::social.tmp.admin', 'layout.base'), 'section_main' => Config::get('social::social.tmp.section_main', 'main'));
$header_title = array('clase' => 'fa fa-share-alt', 'titulo' => 'Social <small>Publicaciones</small>');
return View::make('social::listPublications', compact('post', 'tmp', 'header_title'));
}
示例14: indexAction
/**
* Shows the issues view.
*
* @return \Illuminate\View\View
*/
public function indexAction()
{
$state = Request::get('state');
// Issue & Issue Project list.
$usedIssueProjects = Issue::where('project_id', '>', 0)->where('state', '=', $state)->groupBy('project_id')->lists('project_id');
$issueProjects = Project::whereIn('id', $usedIssueProjects)->get();
return View::make('dashboard.issues.index')->withIssueProjects($issueProjects)->withPageTitle(trans('dashboard.issues.issues') . ' - ' . trans('dashboard.dashboard'));
}
示例15: authenticate
public function authenticate()
{
if (Auth::attempt(['email' => Request::get('email'), 'password' => Request::get('password')])) {
return redirect()->intended('/');
} else {
return view('login', array('title' => 'Welcome', 'description' => '', 'page' => 'home'));
}
}