本文整理汇总了PHP中Illuminate\Support\Facades\Request::except方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::except方法的具体用法?PHP Request::except怎么用?PHP Request::except使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\Request
的用法示例。
在下文中一共展示了Request::except方法的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: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
session_start();
$loguser = $_SESSION['user_id'];
$input = Request::except('tax');
// var_dump($input);
//
// die();
if (isset($_GET['cid'])) {
$input['contact_id'] = $_GET['cid'];
$input['customer_id'] = $_GET['cid'];
} else {
$input['contact_no'] = $input['cli'];
$input['contact_owner'] = $loguser;
$input['contact_id'] = App\contact::create($input)->id;
$input['customer_id'] = $input['contact_id'];
}
$input['call_owner'] = $loguser;
$input['assignedto'] = $input['assignedto1'];
$input['group_id'] = $input['group_id1'];
$last_id = App\call_log::create($input)->id;
$input['call_log_id'] = $last_id;
if ($input['call_type'] == "Inquiry") {
if ($input['status'] == "complete") {
$endtime = date('Y-m-d H:i:s');
} else {
$endtime = NULL;
}
$input['inquiry_end_time'] = $endtime;
App\inquiry::create($input);
} elseif ($input['call_type'] == "Sales") {
$input['owner_id'] = $loguser;
$input['total'] = $_POST['sub_total'];
$sale = App\sale::create($input);
$last_id1 = $sale->id;
//$log = new crm_log;
//$log->add_log("sales",$last_id1,"insert"); // add a log
$cart_details = App\cart::where('user', $loguser)->get();
foreach ($cart_details as $row4) {
// select data from cart table
$input = ['category' => $row4->category, 'product' => $row4->product, 'price' => $row4->price, 'sale_id' => $last_id1, 'qty' => $row4->qty, 'tax' => $row4->tax, 'discount' => $row4->discount];
$last_sp_id = DB::table('sales_product')->insertGetId($input);
//$sql5="INSERT INTO `sales_product`(`id`, `category`, `product`,`price`,`sale_id`, `qty`, `tax`, `discount`) VALUES(NULL,'$row4[category]','$row4[product]','$row4[price]','$last_id1','$row4[qty]','$row4[tax]','$row4[discount]')";
$cart_tax_details = App\cart_tax::where('cart_id', $row4->id)->get();
foreach ($cart_tax_details as $row6) {
$sql_s = "INSERT INTO `s_p_tax`(`s_p_id`, `tax_id`, `tax_name`, `tax_value`, `user`) VALUES ('{$last_sp_id}','{$row6->tax_id}','{$row6->tax_name}','{$row6->tax_value}','{$loguser}')";
DB::insert(DB::raw($sql_s));
// add data to sales product tax table
}
}
$cart = new cart();
$cart->delete_user_cart();
// remove cart data
} elseif ($input['call_type'] == "Tickets") {
$input['owner'] = $loguser;
$ticket_id = App\ticket::create($input)->id;
$input['last_id_ticket'] = $ticket_id;
App\ticket_problem::create($input);
}
}
示例3: postUpdateProject
/**
* Updates a project with the entered info.
*
* @param \Gitamin\Models\Project $project
*
* @throws \Exception
*
* @return \Gitamin\Models\Project
*/
public function postUpdateProject(Project $project)
{
if (!$project->update(Request::except(['_token']))) {
throw new Exception(trans('dashboard.projects.edit.failure'));
}
return $project;
}
示例4: byPage
/**
* Get paginated models.
*
* @param int $page Number of models per page
* @param int $limit Results per page
* @param bool $all get published models or all
* @param array $with Eager load related models
*
* @return stdClass Object with $items && $totalItems for pagination
*/
public function byPage($page = 1, $limit = 10, array $with = [], $all = false)
{
$cacheKey = md5(config('app.locale') . 'byPage.' . $page . $limit . $all . serialize(Request::except('page')));
if ($this->cache->has($cacheKey)) {
return $this->cache->get($cacheKey);
}
$models = $this->repo->byPage($page, $limit, $with, $all);
// Store in cache for next request
$this->cache->put($cacheKey, $models);
return $models;
}
示例5: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$data = Request::all();
$rules = array('first_name' => 'required', 'last_name' => 'required', 'email' => 'required', 'password' => 'required', 'type' => 'required');
$v = Validator::make($data, $rules);
if ($v->fails()) {
return redirect()->back()->withErrors($v->errors())->withInput(Request::except('password'));
}
//Otra manera
//$user = new User($request->all());
//$user->save();
//return \Redirect::route('admin.users.index');
$user = User::create($data);
return redirect()->route('admin.users.index');
}
示例6: loginPost
/**
* Logs the user in.
*
* @return \Illuminate\Http\RedirectResponse
*/
public function loginPost()
{
$loginData = Request::only(['login', 'password']);
// Login with username or email.
$loginKey = Str::contains($loginData['login'], '@') ? 'email' : 'username';
$loginData[$loginKey] = array_pull($loginData, 'login');
// Validate login credentials.
if (Auth::validate($loginData)) {
// Log the user in for one request.
Auth::once($loginData);
// We probably want to add support for "Remember me" here.
Auth::attempt($loginData);
//return Redirect::intended('/')
return Redirect::home()->withSuccess(trans('gitamin.signin.success'));
}
return Redirect::route('auth.login')->withInput(Request::except('password'))->withError(trans('gitamin.signin.invalid'));
}
示例7: encodeResult
/**
* 统一返回格式
* @param $msgcode
* @param null $message
* @param null $data
* @return string
*/
protected function encodeResult($msgcode, $message = NULL, $data = NULL)
{
if ($data == null) {
$data = new \stdClass();
}
$log = new RestLog();
$log->request = json_encode(Request::except('file'));
$log->request_route = Route::currentRouteName();
$log->response = json_encode($data);
$log->msgcode = $msgcode;
$log->message = $message;
$log->client_ip = Request::getClientIp();
$log->client_useragent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : NULL;
if (Auth::check()) {
$log->user_id = Auth::user()->user_id;
}
$log->save();
$result = array("rest_id" => $log->id, 'msgcode' => $msgcode, 'message' => $message, 'date' => $data, 'version' => '1.0', 'servertime' => time());
return \Response::json($result);
}
示例8: postSignup
/**
* Handle the unsubscribe.
*
* @param string|null $code
*
* @return \Illuminate\View\View
*/
public function postSignup($code = null)
{
/*
if ($code === null) {
throw new NotFoundHttpException();
}
$invite = Invite::where('code', '=', $code)->first();
if (!$invite || $invite->claimed()) {
throw new BadRequestHttpException();
}
*/
$code = 'gitamin';
try {
$user = $this->dispatch(new SignupUserCommand(Request::get('username'), Request::get('password'), Request::get('email'), 2));
} catch (ValidationException $e) {
return Redirect::route('signup.signup', ['code' => $code])->withInput(Request::except('password'))->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('gitamin.signup.failure')))->withErrors($e->getMessageBag());
} catch (UserAlreadyTakenException $e) {
return Redirect::route('signup.signup', ['code' => $code])->withInput(Request::except('password'))->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('gitamin.signup.failure')))->withErrors(trans('gitamin.signup.taken'));
}
//$this->dispatch(new ClaimInviteCommand($invite));
return Redirect::route('auth.login')->withSuccess(sprintf('<strong>%s</strong> %s', trans('dashboard.notifications.awesome'), trans('gitamin.signup.success')));
}
示例9: createUrl
/**
* Create url for navigation
*
* @param array $parameters
* @return string
*/
public function createUrl(array $parameters = [])
{
$baseUrl = $this->getBaseURL();
$parameters = array_merge(Request::except('ajax'), $parameters);
// build url query string
$query_string = http_build_query($parameters, null, '&');
$raw_param = !empty($query_string) ? "?" . $query_string : null;
return $baseUrl . $raw_param . $this->buildFragment();
}
示例10: update
/**
* Update the specified resource in storage. If it has been deleted, this will undelete it.
*
* @param int $id
* @return Response
*/
public function update(Comment $comment)
{
if (!Auth::user()->can('create-comments')) {
abort(401, 'You do not have permission to update a comment');
}
if (!$comment) {
abort(400, 'Comment does not exist');
}
if ($comment->user->id != Auth::user()->id && !Auth::user()->can('administrate-comment')) {
abort(401, 'User does not have permission to edit this comment');
}
$comment->secureFill(Request::except('token'));
if (!$comment->save()) {
//Validation failed show errors
abort(403, $comment->errors);
}
return $comment;
}
示例11: postSettings
/**
* Updates the system settings.
*
* @return \Illuminate\View\View
*/
public function postSettings()
{
$redirectUrl = Session::get('redirect_to', route('admin.settings.general'));
if (Request::get('remove_banner') === '1') {
$setting = Setting::where('name', 'app_banner');
$setting->delete();
}
if (Request::hasFile('app_banner')) {
$file = Request::file('app_banner');
// Image Validation.
// Image size in bytes.
$maxSize = $file->getMaxFilesize();
if ($file->getSize() > $maxSize) {
return Redirect::to($redirectUrl)->withErrors(trans('admin.settings.general.too-big', ['size' => $maxSize]));
}
if (!$file->isValid() || $file->getError()) {
return Redirect::to($redirectUrl)->withErrors($file->getErrorMessage());
}
if (!starts_with($file->getMimeType(), 'image/')) {
return Redirect::to($redirectUrl)->withErrors(trans('admin.settings.general.images-only'));
}
// Store the banner.
Setting::firstOrCreate(['name' => 'app_banner'])->update(['value' => base64_encode(file_get_contents($file->getRealPath()))]);
// Store the banner type
Setting::firstOrCreate(['name' => 'app_banner_type'])->update(['value' => $file->getMimeType()]);
}
try {
foreach (Request::except(['app_banner', 'remove_banner']) as $settingName => $settingValue) {
Setting::firstOrCreate(['name' => $settingName])->update(['value' => $settingValue]);
}
} catch (Exception $e) {
return Redirect::to($redirectUrl)->withErrors(trans('admin.settings.edit.failure'));
}
if (Request::has('app_locale')) {
Lang::setLocale(Request::get('app_locale'));
}
return Redirect::to($redirectUrl)->withSuccess(trans('admin.settings.edit.success'));
}
示例12: allNested
/**
* Get all models and nest.
*
* @param bool $all Show published or all
* @param array $with Eager load related models
*
* @return NestedCollection
*/
public function allNested(array $with = [], $all = false)
{
$cacheKey = md5(config('app.locale') . 'allNested' . serialize($with) . $all . serialize(Request::except('page')));
if ($this->cache->has($cacheKey)) {
return $this->cache->get($cacheKey);
}
// Item not cached, retrieve it
$models = $this->repo->allNested($with, $all);
// Store in cache for next request
$this->cache->put($cacheKey, $models);
return $models;
}
示例13: generateLink
private function generateLink($direction)
{
$dt = $this->base_dt->copy();
if ($this->mode == 'week') {
$direction == 'prev' ? $dt->modify('last sunday') : $dt->modify('next sunday');
} else {
if ($this->mode == 'day') {
$direction == 'prev' ? $dt->subDay() : $dt->addDay();
} else {
$dt = $direction == 'prev' ? $dt->modify('first day of previous month') : $dt->modify('first day of next month');
}
}
$base_date = $this->mode == 'month' ? $dt->format('Y-m') : $dt->format('Y-m-d');
$url = Request::url() . '?base_date=' . $base_date . '&' . http_build_query(Request::except('base_date'));
$class = isset($this->classes[$direction]) ? $this->generateClass($this->classes[$direction]) : '';
$onclick = '';
if (!empty($this->navigation_js_function)) {
$url = '#';
$onclick = ' onclick="return ' . $this->navigation_js_function . '(\'' . $base_date . '\');"';
}
return '<a id="julius_' . $direction . '_' . $this->mode . '" href="' . $url . '"' . $class . ' data-date="' . $base_date . '"' . $onclick . '>' . $this->icons[$direction] . '</a>';
}
示例14: getNeatnessUrls
private function getNeatnessUrls($current_key, $current_direction)
{
$original_params = [];
if (isset($this->neatness['appends'])) {
$original_params = Request::only($this->neatness['appends']);
} else {
$original_params = Request::except([$this->_neatness_order_by, $this->_neatness_direction]);
}
$urls = [];
foreach ($this->neatness['columns'] as $key => $column) {
$direction = $key == $current_key ? $this->getNeatnessReverseDirection($current_direction) : $this->neatness['default'][1];
$params = $original_params + [$this->_neatness_order_by => $key, $this->_neatness_direction => $direction];
$urls[$key] = Request::url() . '?' . http_build_query($params);
}
return collect($urls);
}
示例15: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
session_start();
$loguser = $_SESSION['user_id'];
$data = Request::except('tax');
$data['customer_id'] = $_SESSION['contact_report_to'];
$data['call_log_id'] = 0;
$data['owner_id'] = $loguser;
$data['total'] = $_POST['sub_total'];
$sale = App\sale::create($data);
$last_id1 = $sale->id;
//$sql3="INSERT INTO `sales`(`id`,`call_log_id`, `customer_id`, `category_id`,`product_id`, `qty`, `owner_id`, `created_time`, `modified_by`, `modified_time`, `assignedto`, `tax`, `discount`, `total`, `status`, `account_id`, `date`, `remark`,`group`) VALUES
//(NULL,'0','$_SESSION[contact_report_to]',NULL,NULL,NULL,'$loguser',SYSDATE(),NULL,NULL,'$_POST[assigned_to]',NULL,NULL,'$_POST[sub_total]','$_POST[status]',NULL,'$_POST[date]','$_POST[remark1]','$_POST[group_id]')";
//$log = new crm_log;
//$log->add_log("sales",$last_id1,"insert"); // add a log
$cart_details = App\cart::where('user', $loguser)->get();
foreach ($cart_details as $row4) {
// select data from cart table
$data = ['category' => $row4->category, 'product' => $row4->product, 'price' => $row4->price, 'sale_id' => $last_id1, 'qty' => $row4->qty, 'tax' => $row4->tax, 'discount' => $row4->discount];
$last_sp_id = DB::table('sales_product')->insertGetId($data);
//$sql5="INSERT INTO `sales_product`(`id`, `category`, `product`,`price`,`sale_id`, `qty`, `tax`, `discount`) VALUES(NULL,'$row4[category]','$row4[product]','$row4[price]','$last_id1','$row4[qty]','$row4[tax]','$row4[discount]')";
$cart_tax_details = App\cart_tax::where('cart_id', $row4->id)->get();
foreach ($cart_tax_details as $row6) {
$sql_s = "INSERT INTO `s_p_tax`(`s_p_id`, `tax_id`, `tax_name`, `tax_value`, `user`) VALUES ('{$last_sp_id}','{$row6->tax_id}','{$row6->tax_name}','{$row6->tax_value}','{$loguser}')";
DB::insert(DB::raw($sql_s));
// add data to sales product tax table
}
}
App\cart::where('user', $loguser)->delete();
App\cart_tax::where('user', $loguser)->delete();
return redirect('sale');
}