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


PHP Request::isMethod方法代码示例

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


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

示例1: login

 public function login()
 {
     if (Request::isMethod('get')) {
         $company = DB::table('tb_global_settings')->where('name', 'company')->first();
         $product = DB::table('tb_product')->join('tb_global_settings', function ($join) {
             $join->on('tb_product.name', '=', 'tb_global_settings.value')->where('tb_global_settings.name', '=', 'product');
         })->select('tb_product.description')->first();
         return View::make('login.login')->with('product', ($company ? $company->value : '') . ($product ? $product->description : ''));
     } else {
         if (Request::isMethod('post')) {
             $ip_string = Request::getClientIp(true);
             $user = array('username' => Input::get('username'), 'password' => Input::get('password'));
             $remember = Input::has('remember_me') ? true : false;
             if (false !== ($msg = SysAccountFrozenController::isFrozenIp($ip_string))) {
                 return Redirect::to('/login')->with('login_error_info', '禁止登录!此IP(' . $ip_string . ')已被冻结!<br/>' . $msg);
             }
             if (false === SysAccountController::isInBindip($user['username'], $ip_string)) {
                 return Redirect::to('/login')->with('login_error_info', '禁止登录!此账户已绑定IP!');
             }
             if (Auth::attempt($user, $remember)) {
                 SysAccountFrozenController::delRecord($ip_string);
                 return Redirect::to('/')->with('login_ok_info', $user['username'] . '登录成功');
             } else {
                 SysAccountFrozenController::appendRecord($ip_string);
                 return Redirect::to('/login')->with('login_error_info', '用户名或者密码错误')->withInput();
             }
         } else {
             return Response::make('访问login页面的方法只能是GET/POST方法!', 404);
         }
     }
 }
开发者ID:252114997,项目名称:ourshow,代码行数:31,代码来源:LoginController.php

示例2: login

 public function login()
 {
     if (Request::isMethod('post')) {
         return $this->postLogin();
     }
     return View::make('login');
 }
开发者ID:phucps89,项目名称:Tour,代码行数:7,代码来源:HomeController.php

示例3: lock

 public function lock()
 {
     $prevURL = URL::previous();
     if (Request::ajax()) {
         $admin = Auth::admin()->get();
         if (!Input::has('password')) {
             $message = 'You must enter password to re-login.';
         } else {
             if (Hash::check(Input::get('password'), $admin->password)) {
                 Session::forget('lock');
                 Session::flash('flash_success', 'Welcome back.<br />You has been login successful!');
                 return ['status' => 'ok'];
             }
             $message = 'Your password is not correct.';
         }
         return ['status' => 'error', 'message' => $message];
     } else {
         if (Request::isMethod('get')) {
             Session::put('lock', true);
         }
     }
     if (empty($prevURL) || strpos($prevURL, '/admin/lock') !== false) {
         $prevURL = URL . '/admin';
     }
     return Redirect::to($prevURL);
 }
开发者ID:nguyendaivu,项目名称:imagestock,代码行数:26,代码来源:AdminController.php

示例4: boot

 /**
  * Register any other events for your application.
  *
  * @param \Illuminate\Contracts\Events\Dispatcher $events
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     if (!\Request::isMethod('GET')) {
         $events->subscribe(PushNotificationHandler::class);
     }
 }
开发者ID:adminrt,项目名称:phphub-server,代码行数:12,代码来源:EventServiceProvider.php

示例5: login

 public function login()
 {
     if (UserAuthController::isLogin()) {
         return Redirect::to('/welcome');
     }
     if (Request::isMethod('get')) {
         $user_id = Input::get('id', null);
         $user_info = tb_users::where('id', $user_id)->first();
         if (null == $user_info) {
             return View::make('login')->with('deny_info', '链接失效!')->with('deny_user_id', $user_id);
         }
         // 使用免登录金牌
         if (true !== UserAuthController::login($user_id, null)) {
             return Response::make(View::make('login'))->withCookie(Cookie::make('user_id', $user_id));
         }
         return Redirect::to('/welcome');
     }
     if (Request::isMethod('post')) {
         // 使用邀请码登录
         $token = Input::get('token');
         $user_id = Cookie::get('user_id');
         self::recordAccessLog(array('token' => $token, 'user_id' => $user_id));
         $error_info = UserAuthController::login($user_id, $token);
         if (true !== $error_info) {
             return Redirect::back()->with('error_info', $error_info)->withInput();
         }
         return Redirect::to('/welcome');
     }
     return Response::make('此页面只能用GET/POST方法访问!', 404);
 }
开发者ID:252114997,项目名称:ourshow,代码行数:30,代码来源:MainFrameController.php

示例6: edit

 /**
  * Создание категории
  */
 public function edit($id)
 {
     if (!User::isAdmin()) {
         App::abort('403');
     }
     if (!($category = Category::find_by_id($id))) {
         App::abort('default', 'Категория не найдена!');
     }
     if (Request::isMethod('post')) {
         $category->token = Request::input('token', true);
         $category->parent_id = Request::input('parent_id');
         $category->name = Request::input('name');
         $category->slug = Request::input('slug');
         $category->description = Request::input('description');
         $category->sort = Request::input('sort');
         if ($category->save()) {
             App::setFlash('success', 'Категория успешно изменена!');
             App::redirect('/category');
         } else {
             App::setFlash('danger', $category->getErrors());
             App::setInput($_POST);
         }
     }
     $categories = Category::getAll();
     App::view('categories.edit', compact('category', 'categories'));
 }
开发者ID:visavi,项目名称:rotorcms,代码行数:29,代码来源:CategoryController.php

示例7: changepwd

 public function changepwd()
 {
     $error = '';
     if (Request::isMethod('post')) {
         $oldpwd = trim(Input::get('oldpwd'));
         $newpwd = trim(Input::get('newpwd'));
         $repwd = trim(Input::get('repwd'));
         $project_ids = Input::get('project', array());
         if (!$oldpwd || !$newpwd) {
             $error = '信息填写不完整';
         } else {
             if (!Auth::validate(array('username' => Auth::user()->username, 'password' => $oldpwd))) {
                 $error = '旧密码不正确';
             } else {
                 if ($newpwd != $repwd) {
                     $error = '2次输入的新密码不一致!';
                 }
             }
         }
         if (!$error) {
             Auth::user()->password = Hash::make($newpwd);
             Auth::user()->save();
             return Redirect::action('ProjectsController@allProjects');
         }
     }
     return View::make('users/pwd', array('error' => $error));
 }
开发者ID:xiaomantou88,项目名称:svn_publisher,代码行数:27,代码来源:UsersController.php

示例8: showUpdate

 /**
  *     add/update agency
  *     @param  integer $id 
  */
 function showUpdate($id = 0)
 {
     $this->data['id'] = $id;
     View::share('jsTag', HTML::script("{$this->assetURL}js/select.js"));
     // get list country
     $countryModel = new CountryBaseModel();
     $this->data['listCountry'] = $countryModel->getAllForm();
     // get list Category
     $categoryModel = new CategoryBaseModel();
     $this->data['listCategory'] = $categoryModel->getAllForm();
     // get expected close month
     $this->data['listExpectedCloseMonth'] = getMonthRange();
     // get list Currency
     $currencyModel = new CurrencyBaseModel();
     $this->data['listCurrency'] = $currencyModel->getAllForm();
     // get list Sale Status
     $this->data['listSaleStatus'] = Config::get('data.sale_status');
     $this->loadLeftMenu('menu.campaignList');
     // WHEN UPDATE SHOW CURRENT INFORMATION
     if ($id != 0) {
         $item = $this->model->with('agency', 'advertiser', 'sale', 'campaign_manager')->find($id);
         if ($item) {
             $this->data['item'] = $item;
             $this->loadLeftMenu('menu.campaignUpdate', array('item' => $item));
         } else {
             return Redirect::to($this->moduleURL . 'show-list');
         }
     }
     if (Request::isMethod('post')) {
         if ($this->postUpdate($id, $this->data)) {
             return Redirect::to($this->moduleURL . 'view/' . $this->data['id']);
         }
     }
     $this->layout->content = View::make('showUpdate', $this->data);
 }
开发者ID:huycao,项目名称:yoplatform,代码行数:39,代码来源:CampaignAdvertiserManagerController.php

示例9: showUpdate

 /**
  *     add/update agency
  *     @param  integer $id 
  */
 function showUpdate($id = 0)
 {
     $this->data['id'] = $id;
     View::share('jsTag', HTML::script("{$this->assetURL}js/select.js"));
     // get list Category
     $categoryModel = new CategoryBaseModel();
     $this->data['listCategory'] = $categoryModel->getAllForm(0);
     // get list Ad Format
     $AdFormatModel = new AdFormatBaseModel();
     $this->data['listAdFormat'] = $AdFormatModel->getAllForm();
     // get list Type
     $this->data['listAdType'] = Config::get('data.ad_type');
     // get list Wmode
     $this->data['listWmode'] = Config::get('data.wmode');
     // WHEN UPDATE SHOW CURRENT INFOMATION
     if ($id != 0) {
         $item = $this->model->with('campaign', 'adFormat')->find($id);
         if ($item) {
             $this->data['item'] = $item;
         } else {
             return Redirect::to($this->moduleURL . 'show-list');
         }
     }
     if (Request::isMethod('post')) {
         if ($this->postUpdate($id, $this->data)) {
             return $this->redirectAfterSave(Input::get('save'));
         }
     }
     $this->layout->content = View::make('showUpdate', $this->data);
 }
开发者ID:huycao,项目名称:yoplatform,代码行数:34,代码来源:AdFlightAdvertiserManagerController.php

示例10: showUpdate

 function showUpdate($id = 0)
 {
     $this->data['id'] = $id;
     $this->data['groups'] = UserGroup::get();
     // WHEN UPDATE SHOW CURRENT INFOMATION
     if ($id != 0) {
         $item = $this->model->find($id);
         // CHECK SUPER USER
         if ($item->isSuperUser()) {
             return Redirect::to($this->moduleURL . 'show-list');
         }
         // END SUPER USER
         $item->group = $item->getGroups()->first();
         if ($item) {
             $this->data['item'] = $item;
         } else {
             return Redirect::to($this->moduleURL . 'show-list');
         }
     }
     if (Request::isMethod('post')) {
         if ($this->postUpdate($id, $this->data)) {
             return $this->redirectAfterSave(Input::get('save'));
         }
     }
     $this->layout->content = View::make('showUpdate', $this->data);
 }
开发者ID:huycao,项目名称:yoplatform,代码行数:26,代码来源:AdsAdminController.php

示例11: change

 public function change()
 {
     if (Request::isMethod('post')) {
         try {
             $rules = Validator::make(Input::all(), ['password' => 'required|confirmed', 'password_confirmation' => 'required']);
             if ($rules->fails()) {
                 throw new Exception('Todos los campos son obligatorios');
             }
             $data = explode('@', Input::get('data'));
             $id = base64_decode($data[1]);
             $user = Sentry::findUserById($id);
             $admin = Sentry::findGroupByName('Administrador');
             if (!$user->checkResetPasswordCode($data[0])) {
                 throw new Exception('El código de chequeo no es correcto.');
             }
             if (!$user->attemptResetPassword($data[0], Input::get('password_confirmation'))) {
                 throw new Exception('Se presento un error al guardar la nueva contraseña.');
             }
             if (!$user->inGroup($admin) || !$user->isActivated()) {
                 throw new Exception('Este usuario no tiene permisos para ingresar o esta inactivo.');
             }
             Sentry::login($user);
             return Redirect::route('admin.dashboard');
         } catch (Exception $e) {
             $uri = URL::route('admin.forgot-reset', [Input::get('data')]);
             return Redirect::to($uri)->with('message', $e->getMessage());
         }
     }
 }
开发者ID:eldalo,项目名称:jarvix,代码行数:29,代码来源:AdminController.php

示例12: editItem

 public function editItem()
 {
     if (Request::isMethod('post')) {
         $id = Input::get('item_id');
         $updateVal = array('am_name' => Input::get('item_name'), 'am_description' => Input::get('item_desc'), 'am_quantity' => Input::get('stock'), 'am_capacity' => Input::get('capacity'), 'am_price' => str_replace(',', '', Input::get('price')), 'am_group' => Input::get('item_type'));
         $whereVal = array('am_id' => $id);
         $this->GlobalModel->updateModel('tbl_amenities', $whereVal, $updateVal);
         if (Input::hasFile('item_image')) {
             $files = Input::file('item_image');
             $i = 1;
             foreach ($files as $file) {
                 try {
                     $path = public_path() . '\\uploads\\amenity_type\\';
                     $extension = $file->getClientOriginalExtension();
                     $filename = pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME);
                     $dateNow = date('Ymd_His');
                     $new_filename = Auth::user()->id . '_' . $dateNow . '_' . $i . '.' . $extension;
                     $upload_success = $file->move($path, $new_filename);
                 } catch (Exception $ex) {
                     $path = public_path() . '/uploads\\amenity_type/';
                     $extension = $file->getClientOriginalExtension();
                     $filename = pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME);
                     $dateNow = date('Ymd_His');
                     $new_filename = Auth::user()->id . '_' . $dateNow . '_' . $i . '.' . $extension;
                     $upload_success = $file->move($path, $new_filename);
                 }
                 $insertVal = array('image_fieldvalue' => $id, 'image_name' => $new_filename);
                 $this->GlobalModel->insertModel('tbl_images', $insertVal);
                 $i++;
             }
         }
         $this->TransLog->transLogger('Amenity Module', 'Edited Amenity', $id);
     }
 }
开发者ID:axisssss,项目名称:ORS,代码行数:34,代码来源:AdminAmenitiesController.php

示例13: delete

 public function delete()
 {
     $pageId = Input::get('pageId', null);
     if (!$pageId) {
         return 'Invalid url! Page Id not passed!';
     }
     try {
         $page = Page::findOrFail($pageId ? $pageId : $pageData['id']);
     } catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) {
         return 'Invalid page! The page you are trying to delete doesn\'t exist.';
     }
     if (Request::isMethod('post')) {
         //POST method - confirmed - Delete now!
         if ($page->delete()) {
             $deleteSuccess = true;
         } else {
             $deleteSuccess = false;
         }
         return View::make('admin/pages/delete')->with(array('page' => Page::decodePageJson($page), 'deleteSuccess' => $deleteSuccess));
     } else {
         if (Request::isMethod('get')) {
             //Ask for confirmation
             return View::make('admin/pages/delete')->with(array('page' => Page::decodePageJson($page), 'getConfirmation' => true));
         }
     }
 }
开发者ID:thunderclap560,项目名称:quizkpop,代码行数:26,代码来源:AdminPagesController.php

示例14: edit

 public function edit($id)
 {
     if (Request::isMethod('post')) {
         $rules = array('title' => 'required|min:4', 'link' => 'required', 'meta_keywords' => 'required');
         $validator = Validator::make(Input::all(), $rules);
         if ($validator->fails()) {
             return Redirect::to("admin/category/{$id}/edit")->withErrors($validator)->withInput(Input::except(''));
         } else {
             $table = Category::find($id);
             $table->title = Input::get('title');
             $table->link = Input::get('link');
             $table->content = Input::get('content');
             $table->parent_id = Input::get('parent_id') ? Input::get('parent_id') : null;
             $table->meta_title = Input::get('meta_title') ? Input::get('meta_title') : $table->title;
             $table->meta_description = Input::get('meta_description') ? Input::get('meta_description') : $table->description;
             $table->meta_keywords = Input::get('meta_keywords');
             $table->active = Input::get('active', 0);
             if ($table->save()) {
                 $name = trans("name.category");
                 return Redirect::to("admin/category")->with('success', trans("message.edit", ['name' => $name]));
             }
             return Redirect::to("admin/category")->with('error', trans('message.error'));
         }
     }
     $self = Category::where('id', '=', $id)->first();
     foreach (Category::lists('title', 'id') as $key => $value) {
         $child = Category::where('id', '=', $key)->first();
         if (!$child->isSelfOrDescendantOf($self)) {
             $categories[$key] = $value;
         }
     }
     $categories = array(0 => 'Нет родительской категории') + $categories;
     return View::make("admin.shop.category.edit", ['item' => Category::find($id), 'categories' => $categories]);
 }
开发者ID:Rotron,项目名称:shop,代码行数:34,代码来源:AdminCategoryController.php

示例15: login

 public function login()
 {
     if (Request::isMethod('get')) {
         if (Auth::check()) {
             return Redirect::to('beranda');
         } else {
             return View::make('v_login');
         }
     } else {
         if (Request::isMethod('post')) {
             $input = Input::all();
             $rules = array('username' => 'required', 'password' => 'required');
             $messages = array('username.required' => 'username tidak boleh kosong', 'password.required' => 'password tidak boleh kosong');
             $validasi = BaseController::validasi($input, $rules, $messages);
             if ($validasi->validator->fails()) {
                 return Redirect::to('login')->with('error', $validasi->PesanError);
             } else {
                 if (Auth::attempt(array('username' => Input::get('username'), 'password' => Input::get('password')))) {
                     return Redirect::intended('beranda');
                 } else {
                     return Redirect::to('login')->with('error', 'kombinasi username dan password salah');
                 }
             }
         }
     }
 }
开发者ID:FaddliLWibowo,项目名称:SimPak,代码行数:26,代码来源:Clogin.php


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