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


PHP URL::previous方法代码示例

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


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

示例1: insert

 public function insert(Request $request)
 {
     if (!isset($request)) {
         return redirect(URL::previous())->withError("Error");
     }
     $msg = "";
     $flag = false;
     if (Session::has('product')) {
         $products = Session::get('product');
         foreach ($products as $item) {
             //
             if ($item['id'] == $request->id) {
                 $flag = true;
                 $msg = "Product Item Exists";
             }
         }
     }
     if ($flag == false) {
         $result = Product::find($request->id);
         $image = $result->image;
         $name = $result->name;
         $price = $result->price;
         $total = $request->number * $price;
         $data = array('id' => $request->id, 'image' => $image, 'name' => $name, 'number' => $request->number, 'price' => $price, 'total' => $total);
         Session::push('product', $data);
         $msg = "Product Item In Cart";
     }
     return redirect(URL::previous())->withSuccess($msg);
 }
开发者ID:dhduc,项目名称:shopui,代码行数:29,代码来源:CartController.php

示例2: rollback

 public function rollback($entity, $id)
 {
     $modelString = 'Yab\\Quarx\\Models\\' . ucfirst($entity);
     if (!class_exists($modelString)) {
         $modelString = 'Yab\\Quarx\\Models\\' . ucfirst($entity) . 's';
     }
     if (!class_exists($modelString)) {
         $modelString = 'Quarx\\Modules\\' . ucfirst(str_plural($entity)) . '.\\Models\\' . ucfirst(str_plural($entity));
     }
     if (!class_exists($modelString)) {
         $modelString = 'Quarx\\Modules\\' . ucfirst(str_plural($entity)) . '\\Models\\' . ucfirst(str_singular($entity));
     }
     if (!class_exists($modelString)) {
         $modelString = 'Quarx\\Modules\\' . ucfirst(str_singular($entity)) . '\\Models\\' . ucfirst(str_singular($entity));
     }
     if (!class_exists($modelString)) {
         Quarx::notification('Could not rollback Model not found', 'warning');
         return redirect(URL::previous());
     }
     $model = new $modelString();
     $modelInstance = $model->find($id);
     $archive = Archive::where('entity_id', $id)->where('entity_type', $modelString)->limit(1)->offset(1)->orderBy('id', 'desc')->first();
     if (!$archive) {
         Quarx::notification('Could not rollback', 'warning');
         return redirect(URL::previous());
     }
     $archiveData = (array) json_decode($archive->entity_data);
     $modelInstance->fill($archiveData);
     $modelInstance->save();
     Quarx::notification('Rollback was successful', 'success');
     return redirect(URL::previous());
 }
开发者ID:YABhq,项目名称:Quarx,代码行数:32,代码来源:QuarxFeatureController.php

示例3: setTop

 public function setTop($id, $result, Request $request)
 {
     $note = Note::findOrFail($id);
     $note->istop = $result;
     $note->save();
     return redirect(URL::previous());
 }
开发者ID:sandywalker,项目名称:xiehouxing,代码行数:7,代码来源:AdminNoteController.php

示例4: setBest

 public function setBest(Request $request, $id)
 {
     $comment = GuideComment::findOrFail($id);
     $comment->isbest = $request->input('value');
     $comment->save();
     return redirect(URL::previous());
 }
开发者ID:sandywalker,项目名称:xiehouxing,代码行数:7,代码来源:AdminGuideCommentController.php

示例5: destroy

 public function destroy($id)
 {
     $Src = Images::find($id)->imageSrc;
     $imageSrc = URL::to('/') . '/' . $Src;
     File::delete($imageSrc);
     Images::find($id)->delete();
     return redirect(URL::previous())->withSuccess(Lang::get('messages.delete_success'));
 }
开发者ID:dhduc,项目名称:shopui,代码行数:8,代码来源:SliderController.php

示例6: __construct

 /**
  * Create a new controller instance.
  *
  * @return void
  */
 public function __construct()
 {
     $this->middleware('frontguest', ['except' => 'logout']);
     $url = URL::previous();
     $checkoutUrl = route('checkout.index');
     if ($url == $checkoutUrl) {
         $this->redirectTo = $checkoutUrl;
     }
 }
开发者ID:mage2,项目名称:laravel-ecommerce,代码行数:14,代码来源:LoginController.php

示例7: newComment

 public function newComment(CommentFormRequest $request)
 {
     $content = $request->get('content');
     $content = preg_replace('/ /', '&nbsp', $content);
     $content = preg_replace('/\\n/', '<br>', $content);
     $comment = new Comment(array('post_id' => $request->get('post_id'), 'content' => $content));
     $comment->save();
     //        return redirect()->back()->with('status', 'Your comment has been created!');
     return redirect()->to(URL::previous() . "#comment");
 }
开发者ID:weiyeu,项目名称:laravel_date,代码行数:10,代码来源:CommentsController.php

示例8: unFavGuide

 public function unFavGuide($id)
 {
     $guideFav = GuideFav::where('user_id', Auth::user()->id)->where('guide_id', $id)->first();
     if ($guideFav != null) {
         $guide = Guide::findOrFail($id);
         $guideFav->delete();
         $guide->updateFavs();
     }
     return redirect(URL::previous());
 }
开发者ID:sandywalker,项目名称:xiehouxing,代码行数:10,代码来源:FavController.php

示例9: destroy

 public function destroy($id)
 {
     DB::transaction(function () use($id) {
     });
     $imageSrc = Images::find($id)->imageSrc;
     unlink($imageSrc);
     Images::find($id)->delete();
     DB::commit();
     return redirect(URL::previous())->withSuccess(Lang::get('messages.delete_success'));
 }
开发者ID:dhduc,项目名称:shopui,代码行数:10,代码来源:ImagesController.php

示例10: evaluatePath

 /**
  * @param $path
  * @param array $data
  * @return string
  */
 protected function evaluatePath($path, array $data = [])
 {
     $preferences = $this->XSLTSimple->addChild('Preferences');
     $url = $preferences->addChild('url');
     $url->addAttribute('isHttps', Request::secure());
     $url->addAttribute('currentUrl', Request::url());
     $url->addAttribute('baseUrl', URL::to(''));
     $url->addAttribute('previousUrl', URL::previous());
     $server = $preferences->addChild('server');
     $server->addAttribute('curretnYear', date('Y'));
     $server->addAttribute('curretnMonth', date('m'));
     $server->addAttribute('curretnDay', date('d'));
     $server->addAttribute('currentDateTime', date('Y-m-d H:i:s'));
     $language = $preferences->addChild('language');
     $language->addAttribute('current', App::getLocale());
     $default_language = \Config::get('app.default_language');
     if (isset($default_language)) {
         $language->addAttribute('default', $default_language);
     }
     $languages = \Config::get('app.available_languages');
     if (is_array($languages)) {
         foreach ($languages as $lang) {
             $language->addChild('item', $lang);
         }
     }
     // from form generator
     if (isset($data['form'])) {
         $this->XSLTSimple->addChild('Form', form($data['form']));
     }
     // adding form errors to xml
     if (isset($data['errors'])) {
         $this->XSLTSimple->addData($data['errors']->all(), 'FormErrors', false);
     }
     // "barryvdh/laravel-debugbar":
     // adding XML tab
     if (true === class_exists('Debugbar')) {
         $dom = dom_import_simplexml($this->XSLTSimple)->ownerDocument;
         $dom->preserveWhiteSpace = false;
         $dom->formatOutput = true;
         $prettyXml = $dom->saveXML();
         // add new tab and append xml to it
         if (false === \Debugbar::hasCollector('XML')) {
             \Debugbar::addCollector(new \DebugBar\DataCollector\MessagesCollector('XML'));
         }
         \Debugbar::getCollector('XML')->addMessage($prettyXml, 'info', false);
     }
     $xsl_processor = new \XsltProcessor();
     $xsl_processor->registerPHPFunctions();
     $xsl_processor->importStylesheet(simplexml_load_file($path));
     return $xsl_processor->transformToXML($this->XSLTSimple);
 }
开发者ID:gulios,项目名称:xsl-laravel-template-engine,代码行数:56,代码来源:XSLTEngine.php

示例11: postContact

 public function postContact(Request $request)
 {
     $validator = Validator::make($request->all(), ['name' => 'required|string|max:30', 'email' => 'required|email', 'subject' => 'required|string|max:100', 'message' => 'required|max:255']);
     if ($validator->fails()) {
         return Redirect::to(URL::previous() . "#contact")->withErrors($validator)->withInput();
     }
     $content = $request->input('message');
     $name = $request->input('name');
     $email = $request->input('email');
     $subject = $request->input('subject');
     Mail::send('emails.email', ['content' => $content, 'name' => $name, 'email' => $email], function ($message) use($name, $email, $subject) {
         $message->from('jplittleford@gmail.com', 'Jarrad Littleford');
         $message->replyTo($email);
         $message->to('jplittleford@gmail.com', 'Jarrad Littleford');
         $message->subject($subject);
     });
     return Redirect::to(URL::previous() . "#contact")->with('message', 'Your message has been sent');
 }
开发者ID:suspectdoubloon,项目名称:blog,代码行数:18,代码来源:Controller.php

示例12: authenticate

 public function authenticate(Request $request, $locale)
 {
     Sentinel::enableCheckpoints();
     App::setLocale($locale);
     $credentials = ["email" => $request->get("username"), "password" => $request->get("password")];
     if (!is_null($request->get("remember"))) {
         $remember = $request->get("remember");
     } else {
         $remember = false;
     }
     $user = Sentinel::authenticate($credentials, $remember);
     if ($user === false) {
         Flash::error("Username or Password is incorrect");
         return back();
     } elseif (str_contains(URL::previous(), "auth/login")) {
         return redirect(action("HomeController@home"));
     } else {
         return back();
     }
 }
开发者ID:aranna00,项目名称:arankieskamp.me,代码行数:20,代码来源:AuthController.php

示例13: postLogin

 public function postLogin(Request $request)
 {
     $auth = false;
     $this->validate($request, [$this->loginUsername() => 'required', 'password' => 'required']);
     $throttles = $this->isUsingThrottlesLoginsTrait();
     if ($throttles && $this->hasTooManyLoginAttempts($request)) {
         return response()->json(['auth' => $auth, 'error' => 'Too many attempts.']);
     }
     $credentials = $request->only('email', 'password');
     if (Auth::attempt($credentials, $request->has('remember'))) {
         if ($throttles) {
             $this->clearLoginAttempts($request);
         }
         $auth = true;
         // Success
     }
     return response()->json(['auth' => $auth, 'intended' => URL::previous()]);
 }
开发者ID:becast,项目名称:GameReviewSite,代码行数:18,代码来源:AuthController.php

示例14: getRidirect

 /**
  * Riderect user if not valid
  */
 private function getRidirect()
 {
     /* 
      * Important
      * If user has been redirected from auth/login and have no access permission for requested action
      * user will be redirected back to auth/login, this will cause redirect loop
      * 
      *  Solution is to logout user
      * 
      * @todo - add redirect as parameter
      */
     if (ends_with(URL::previous(), 'auth/login')) {
         $this->auth->logout();
         return redirect()->to(config('larbac.redirect.logIn'))->withErrors(['error' => config('larbac.messages.invalidPermission')]);
     }
     /**
      * Is Redirect Loop
      */
     if (!strcmp($this->url->current(), $this->url->previous())) {
         return redirect()->to(config('larbac.redirect.home'))->withErrors(['error' => config('larbac.messages.invalidPermission')]);
     }
     return redirect()->back()->withErrors(['error' => config('larbac.messages.invalidPermission')]);
     /***/
 }
开发者ID:alexpechkarev,项目名称:larbac,代码行数:27,代码来源:LarbacMiddleware.php

示例15: create

 /**
  * Insertion d'une nouvelle enchère dans la BDD
  *
  * @param Request $request
  * @param int $item_id Identifiant de l'item
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function create(Request $request, $item_id)
 {
     $datas = $request->all();
     // Création d'une nouvelle enchère
     $bid = new Bids();
     $bid->user_id = Auth::user()->id;
     $bid->item_id = $item_id;
     $bid->price = trim($datas['price']);
     if ($bid->save()) {
         $request->session()->flash('message', 'success|Votre enchère a bien été saisie !');
     } else {
         $request->session()->flash('message', 'error|Il s\'est passé un truc, dsl');
     }
     return redirect(URL::previous());
 }
开发者ID:Kocal,项目名称:IUT-PHP-Le-Chaudron-Baveur,代码行数:22,代码来源:BidsController.php


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