isMethod() публичный статический Метод

Checks if the request method is of specified type.
public static isMethod ( string $method ) : boolean
$method string Uppercase request method (GET, POST etc)
Результат boolean
Пример #1
0
 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);
         }
     }
 }
Пример #2
0
 public function login()
 {
     if (Request::isMethod('post')) {
         return $this->postLogin();
     }
     return View::make('login');
 }
Пример #3
0
 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);
 }
 /**
  * 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);
     }
 }
Пример #5
0
 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);
 }
Пример #6
0
 /**
  * Создание категории
  */
 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'));
 }
 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));
 }
 /**
  *     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);
 }
 /**
  *     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);
 }
Пример #10
0
 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);
 }
Пример #11
0
 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());
         }
     }
 }
Пример #12
0
 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);
     }
 }
 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));
         }
     }
 }
Пример #14
0
 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]);
 }
Пример #15
0
 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');
                 }
             }
         }
     }
 }
Пример #16
0
 public function edit($id)
 {
     if (Request::isMethod('post')) {
         $rules = array('title' => 'required|min:4', 'link' => 'required', 'content' => 'required|min:50', 'meta_description' => 'required|min:20', 'meta_keywords' => 'required');
         $validator = Validator::make(Input::all(), $rules);
         if ($validator->fails()) {
             return Redirect::to("admin/{$this->name}/{$id}/{$this->action}")->withErrors($validator)->withInput(Input::except(''));
         } else {
             $table = Page::find($id);
             $table->title = Input::get('title');
             $table->link = Input::get('link');
             $table->user_id = Auth::user()->id;
             $table->content = Input::get('content');
             $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->published_at = Page::toDate(Input::get('published_at'));
             $table->active = Input::get('active', 0);
             if ($table->save()) {
                 $name = trans("name.{$this->name}");
                 return Redirect::to("admin/{$this->name}")->with('success', trans("message.{$this->action}", ['name' => $name]));
             }
             return Redirect::to("admin/{$this->name}")->with('error', trans('message.error'));
         }
     }
     return View::make("admin.{$this->name}.{$this->action}", ['item' => Page::find($id), 'name' => $this->name, 'action' => $this->action]);
 }
Пример #17
0
 /**
  *
  * @return nothing
  * @author Tremor
  */
 public function login()
 {
     if (Request::isMethod('post')) {
         $post = Input::all();
         $rules = ['email' => 'required|email', 'password' => 'required'];
         $validator = Validator::make($post, $rules);
         if ($validator->fails()) {
             $this->setMessage($validator->messages()->all(), 'error');
             return Redirect::route('login')->withInput();
         } else {
             $email = trim(Input::get('email'));
             $password = trim(Input::get('password'));
             $remember = Input::get('remember') == 1 ? true : false;
             if (Auth::attempt(array('email' => $email, 'password' => $password, 'is_admin' => 1))) {
                 return Redirect::route('admin');
             } elseif (Auth::attempt(array('email' => $email, 'password' => $password))) {
                 return Redirect::route('home');
             } else {
                 $this->setMessage('failed login', 'error');
                 return Redirect::route('login')->withInput();
             }
         }
     }
     return View::make('auth.signin')->with($this->data);
 }
Пример #18
0
 /**
  * Upload un torrent
  * 
  * @access public
  * @return View torrent.upload
  *
  */
 public function upload()
 {
     $user = Auth::user();
     // Post et fichier upload
     if (Request::isMethod('post')) {
         // No torrent file uploaded OR an Error has occurred
         if (Input::hasFile('torrent') == false) {
             Session::put('message', 'You must provide a torrent for the upload');
             return View::make('torrent.upload', array('categories' => Category::all(), 'user' => $user));
         } else {
             if (Input::file('torrent')->getError() != 0 && Input::file('torrent')->getClientOriginalExtension() != 'torrent') {
                 Session::put('message', 'An error has occurred');
                 return View::make('torrent.upload', array('categories' => Category::all(), 'user' => $user));
             }
         }
         // Deplace et decode le torrent temporairement
         TorrentTools::moveAndDecode(Input::file('torrent'));
         // Array from decoded from torrent
         $decodedTorrent = TorrentTools::$decodedTorrent;
         // Tmp filename
         $fileName = TorrentTools::$fileName;
         // Info sur le torrent
         $info = Bencode::bdecode_getinfo(getcwd() . '/files/torrents/' . $fileName, true);
         // Si l'announce est invalide ou si le tracker et privée
         if ($decodedTorrent['announce'] != route('announce', ['passkey' => $user->passkey]) && Config::get('other.freeleech') == true) {
             Session::put('message', 'Your announce URL is invalid');
             return View::make('torrent.upload', array('categories' => Category::all(), 'user' => $user));
         }
         // Find the right category
         $category = Category::find(Input::get('category_id'));
         // Create the torrent (DB)
         $torrent = new Torrent(['name' => Input::get('name'), 'slug' => Str::slug(Input::get('name')), 'description' => Input::get('description'), 'info_hash' => $info['info_hash'], 'file_name' => $fileName, 'num_file' => $info['info']['filecount'], 'announce' => $decodedTorrent['announce'], 'size' => $info['info']['size'], 'nfo' => Input::hasFile('nfo') ? TorrentTools::getNfo(Input::file('nfo')) : '', 'category_id' => $category->id, 'user_id' => $user->id]);
         // Validation
         $v = Validator::make($torrent->toArray(), $torrent->rules);
         if ($v->fails()) {
             if (file_exists(getcwd() . '/files/torrents/' . $fileName)) {
                 unlink(getcwd() . '/files/torrents/' . $fileName);
             }
             Session::put('message', 'An error has occured may bee this file is already online ?');
         } else {
             // Savegarde le torrent
             $torrent->save();
             // Compte et sauvegarde le nombre de torrent dans  cette catégorie
             $category->num_torrent = Torrent::where('category_id', '=', $category->id)->count();
             $category->save();
             // Sauvegarde les fichiers que contient le torrent
             $fileList = TorrentTools::getTorrentFiles($decodedTorrent);
             foreach ($fileList as $file) {
                 $f = new TorrentFile();
                 $f->name = $file['name'];
                 $f->size = $file['size'];
                 $f->torrent_id = $torrent->id;
                 $f->save();
                 unset($f);
             }
             return Redirect::route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id])->with('message', trans('torrent.your_torrent_is_now_seeding'));
         }
     }
     return View::make('torrent.upload', array('categories' => Category::all(), 'user' => $user));
 }
Пример #19
0
 public function edit($id)
 {
     if (Request::isMethod('post')) {
         $rules = array('status_id' => 'required');
         $validator = Validator::make(Input::all(), $rules);
         if ($validator->fails()) {
             return Redirect::to("admin/{$this->name}/{$id}/{$this->action}")->withErrors($validator)->withInput(Input::except(''));
         } else {
             $table = Order::find($id);
             $table->status_id = Input::get('status_id');
             if ($table->save()) {
                 $name = trans("name.{$this->name}");
                 return Redirect::to("admin/{$this->name}")->with('success', trans("message.{$this->action}", ['name' => $name]));
             }
             return Redirect::to("admin/{$this->name}")->with('error', trans('message.error'));
         }
     }
     $order = DB::table('orders as o')->join('users as u', 'o.user_id', '=', 'u.id')->join('order_status as os', 'o.status_id', '=', 'os.id')->join('orders_details as od', 'o.id', '=', 'od.order_id')->select('o.id', DB::raw('CONCAT(u.firstname, " ", u.lastname) AS fullname'), 'os.title', 'o.created_at', DB::raw('SUM(od.price) AS total'), 'o.comment', 'o.status_id')->where('o.id', $id)->first();
     $products = DB::table('products as p')->join('orders_details as od', 'p.id', '=', 'od.product_id')->join('orders as o', 'od.order_id', '=', 'o.id')->select('p.id', 'p.link', 'p.name', 'od.price', 'od.quantity', DB::raw('od.price * od.quantity AS total'))->where('o.id', $id)->orderBy('o.id', 'asc')->get();
     $ordersStatus = OrderStatus::all();
     foreach ($ordersStatus as $status) {
         $orderStatus[$status['id']] = $status['title'];
     }
     return View::make("admin.shop.order.edit", ['item' => $order, 'name' => $this->name, 'action' => $this->action, 'status' => $orderStatus, 'products' => $products]);
 }
 /**
  * Display customer login screen.
  * 
  * @return Response
  */
 public function login()
 {
     if (Auth::check()) {
         return Redirect::route('profile');
     } elseif (Request::isMethod('post')) {
         $loginValidator = Validator::make(Input::all(), array('email' => 'required', 'password' => 'required'));
         if ($loginValidator->passes()) {
             $inputCredentials = array('email' => Input::get('email'), 'password' => Input::get('password'));
             if (Auth::attempt($inputCredentials)) {
                 $customer = Customer::find(Auth::id());
                 if ($customer->admin_ind) {
                     Session::put('AdminUser', TRUE);
                 }
                 if (is_null($customer->address)) {
                     // If customer does not have address, redirect to create address.
                     return Redirect::route('customer.address.create', Auth::id())->with('message', 'No address found for account.  Please enter a valid address.');
                 }
                 return Redirect::intended('profile')->with('message', 'Login successful.');
             }
             return Redirect::back()->withInput()->withErrors(array('password' => array('Credentials invalid.')));
         } else {
             return Redirect::back()->withInput()->withErrors($loginValidator);
         }
     }
     $this->layout->content = View::make('customers.login');
 }
 /**
  *     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, 0, 'Run of Network');
     // get list Flight Objective
     $this->data['listFlightObjective'] = Config::get('data.flight_objective');
     $this->loadLeftMenu('menu.flightList');
     // WHEN UPDATE SHOW CURRENT INFOMATION
     if ($id != 0) {
         $this->loadLeftMenu('menu.flightUpdate');
         $item = $this->model->with('category', 'campaign', 'publisher', 'publisherSite', 'publisher_ad_zone')->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);
 }
 public function install()
 {
     if (Request::isMethod('post')) {
         $step = Session::get('step');
         $inputs = Input::all();
         foreach ($inputs as $key => $value) {
             Session::put($key, $value);
         }
         if (Input::exists('back')) {
             $step--;
         } else {
             $step++;
         }
         Session::put('step', $step);
         if ($step < 7) {
             return Redirect::to("/install?step=" . $step);
         } else {
             return Redirect::to("/install/complete");
         }
     } else {
         $step = Input::get('step') ? Input::get('step') : 1;
         Session::put('step', $step);
         return View::make("installer.step" . $step);
     }
 }
 public function create()
 {
     $user = Confide::user();
     //throw new Exception($user);
     if (Request::isMethod('GET')) {
         $patient = Patient::find($user->id);
         return View::make('home/patient/create', compact('user', 'patient'));
     } elseif (Request::isMethod('POST')) {
         // Create a new Appointment with the given data
         $user = Confide::user();
         $user->fill(Input::all());
         $user->save();
         // If patient already exists in system
         $patient = Patient::find($user->id);
         if ($patient != null) {
             // Retreive Patient
         } else {
             // Create a new account for the Patient
             $account = new Account();
             $account->patient_id = $user->id;
             $account->save();
             // Create a new Patient
             $patient = new Patient();
             $patient->fill(Input::all());
             //$patient->dob = new Date();
             $patient->user_id = $user->id;
             $patient->save();
         }
         return Redirect::route('home.index');
     }
 }
Пример #24
0
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $rules = ['title' => 'required|min:3|max:100|unique:articles', 'body' => 'required', 'published_at' => 'required'];
     if (\Request::is('article/*') && \Request::isMethod('PUT')) {
         $rules['title'] = 'required|min:3|max:100|unique:articles,title,' . $this->article->id;
     }
     return $rules;
 }
Пример #25
0
 public function getValue()
 {
     parent::getValue();
     if (\Request::isMethod('post') && !\Input::exists($this->name)) {
         $this->value = $this->unchecked_value;
     }
     $this->checked = (bool) ($this->value == $this->checked_value);
 }
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     if (\Request::isMethod('POST')) {
         return ['name' => 'required|min:4|max:50', 'permission_type' => 'required|min:2'];
     } else {
         return [];
     }
 }
Пример #27
0
 /**
  * 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(NotificationListener::class);
         $events->subscribe(TopicListener::class);
     }
 }
Пример #28
0
 public function postContacto()
 {
     if (Request::isMethod('post')) {
         $nombre = Input::get('name');
         $telefono = Input::get('telefono');
         $email = Input::get('email');
         $mensaje = Input::get('mensaje');
     }
 }
 public function resetPassword()
 {
     if (Request::isMethod('get')) {
         return view('users.resetpassword');
     } else {
         if (Request::isMethod('post')) {
             // Process forgot password
         }
     }
 }
 /**
  * Delete Category, related Albums & Images
  *
  * @param int $categoryId
  *
  * @return \Illuminate\View\View | \Illuminate\Http\RedirectResponse
  */
 public function delete($categoryId)
 {
     $category = Category::findOrFail($categoryId);
     if (Request::isMethod('GET')) {
         return View::make('category.delete', compact('category'));
     } elseif (Request::isMethod('POST')) {
         $category->delete();
         return Redirect::to('/categories')->with('success', 'Category deleted');
     }
 }