本文整理汇总了PHP中Illuminate\Support\Facades\Request::isMethod方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::isMethod方法的具体用法?PHP Request::isMethod怎么用?PHP Request::isMethod使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\Request
的用法示例。
在下文中一共展示了Request::isMethod方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
public function login()
{
Session::set('admin_lock_url', null);
$loginForm = new KForm();
$loginForm->addField(FormFieldBase::createByType('login', FormFieldBase::Type_Text)->setRules('required')->setLabel('请输入工号'));
$loginForm->addField(FormFieldBase::createByType('password', FormFieldBase::Type_Password)->setRules('required')->setLabel('请输入密码'));
if (AuthModel::user() !== null) {
return Redirect::action('admin.index');
}
if (Request::isMethod('POST')) {
//是管理员登陆请求
if ($loginForm->validation()) {
$login = $loginForm->value('login');
$password = $loginForm->value('password');
if (AuthModel::attempt(['employee_id' => $login, 'password' => $password])) {
$admin = AuthModel::getUser();
$admin->last_login = new \Carbon\Carbon();
$admin->save();
return Redirect::action('admin.index');
} else {
$loginForm->set_error('password', '错误的用户名或密码');
}
} else {
//
}
}
$this->layout = View::make('laravel-cms::admin-lte/login')->with('form', $loginForm);
}
示例2: contactUs
public function contactUs()
{
$member1 = Session::get('brand_userid');
$member2 = Session::get('member_userid');
if (!empty($member1)) {
$memberdetail = Brandmember::find($member1);
} elseif (!empty($member2)) {
$memberdetail = Brandmember::find($member2);
} else {
$memberdetail = (object) array("email" => "", "fname" => "", "lname" => "");
}
if (Request::isMethod('post')) {
$user_name = Request::input('contact_name');
$user_email = Request::input('contact_email');
$subject = Request::input('contact_subject');
$cmessage = Request::input('message');
$setting = DB::table('sitesettings')->where('name', 'email')->first();
$admin_users_email = $setting->value;
$sent = Mail::send('frontend.cms.contactemail', array('name' => $user_name, 'email' => $user_email, 'messages' => $cmessage), function ($message) use($admin_users_email, $user_email, $user_name) {
$message->from($admin_users_email);
$message->to($user_email, $user_name)->cc($admin_users_email)->subject(Request::input('contact_subject'));
});
if (!$sent) {
Session::flash('error', 'something went wrong!! Mail not sent.');
return redirect('contact-us');
} else {
Session::flash('success', 'Message is sent to admin successfully. We will getback to you shortly');
return redirect('contact-us');
}
}
return view('frontend.cms.contactus', compact('memberdetail'), array('title' => 'Miramix - Contact Us'));
}
示例3: 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ę.');
}
示例4: userList
/**
Method to get information about the logged in user
@param void
@return view
*/
public function userList()
{
if (!Auth::check()) {
return Redirect::to('/');
}
$message = '';
if (Request::isMethod('post')) {
$data = Input::except('_token');
$password = Hash::make(Input::get('password'));
$user = new User();
$user->name = Input::get('name');
$user->email = Input::get('email');
$user->password = $password;
$username = Input::get('name');
$userEmail = Input::get('email');
if ($user->save()) {
try {
Mail::send('emails.welcome', ['userEmail' => $username], function ($m) use($userEmail, $username) {
$m->to($userEmail, $username)->subject('Express Rental');
});
} catch (Exception $ex) {
}
$message = 'Added Successfully';
return Redirect::to('/users/list')->with('message', $message);
} else {
$message = 'Addition not Successfully';
return Redirect::to('/users/list')->withErrors('message', $message);
}
} else {
$allUserInfo = DB::table('users')->orderBy('users.id', 'DESC')->paginate(5);
return view('Home.list')->with(compact('allUserInfo'));
}
}
示例5: register
public function register()
{
if (Request::isMethod('post')) {
User::create(['name' => Request::get('name'), 'email' => Request::get('email'), 'password' => bcrypt(Request::get('password'))]);
}
return Redirect::intended('/');
}
示例6: loginAction
public function loginAction()
{
$this->layout = null;
$user = Sentinel::getUser();
if ($user && !$this->checkRole()) {
return Redirect::route('indexDashboard');
}
if (Request::isMethod('post')) {
$this->data['status'] = false;
$this->data['message'] = "";
$this->checkLogin($this->data);
if ($this->data['status'] === true) {
if (session_id() == '') {
@session_start();
}
// set session for ckeditor
$_SESSION['isLoggedIn'] = true;
$defaultPageConfig = config('trungtnm.backend.default_page_route');
try {
$redirectUrl = route($defaultPageConfig);
} catch (InvalidArgumentException $e) {
$redirectUrl = url($defaultPageConfig);
}
return redirect($redirectUrl);
}
}
return view('TrungtnmBackend::login', $this->data);
}
示例7: cart
public function cart()
{
if (Request::isMethod('post')) {
$this->cartAdd();
}
if (Request::get('product_id')) {
$this->CartProductAmount();
}
$cart = Cart::content();
return view('cart')->with('cart', $cart);
}
示例8: login
public function login()
{
$title = Lang::get('auth::login.title');
if (Request::isMethod('POST')) {
if (Auth::attempt(array('email' => Input::get('email'), 'password' => Input::get('password'), 'activated' => 1, 'suspended' => 0), Input::has('remember'))) {
return Redirect::intended(Config::get('auth::login.redirect'));
}
return Redirect::back()->with('attempt', false)->withInput();
}
return View::make(Config::get('auth::login.view'), compact('title'));
}
示例9: response
/**
* Send output or error.
*
* @param $output
* @param $code
* @return mixed
*/
public static function response($output, $code)
{
if (Request::isMethod('get') && strpos(Request::route()->getName(), 'index') !== false) {
return Response::json($output, $code);
}
if (empty($output) || collect($output)->isEmpty()) {
if ($code === 304) {
return Response::json($output, $code);
}
return Response::json(self::error(64), 404);
}
if ($output === false or $output === 0) {
return Response::json(self::error(64), 404);
}
return Response::json($output, $code);
}
示例10: memberDelete
public function memberDelete(Request $request)
{
$id = (int) Request::segment(3);
$action = Request::segment(4);
if (Request::isMethod('get')) {
$validator = Validator::make(Input::all(), User::$memberDeleteRules);
if ($validator->passes()) {
if (User::deleteMember($id)) {
return Redirect::to('users/members')->with('message', 'The following errors occurred')->withErrors('Delete successfully')->with('flag', 'success');
} else {
return Redirect::to('users/member/' . $id . '/update')->with('message', 'The following errors occurred')->withErrors('Delete failed')->with('flag', 'danger');
}
} else {
return Redirect::to('users/member/' . $id . '/update')->with('message', 'The following errors occurred')->withErrors($validator)->withInput()->with('flag', 'danger');
}
}
}
示例11: reply
public function reply($login, $repo, $issue)
{
$data = ['success' => 0];
if (Request::isMethod('post')) {
$body = trim(Input::get('reply'));
if ($body) {
try {
GitHub::issue()->comments()->create($login, $repo, $issue, ['body' => $body]);
$data['success'] = 1;
} catch (RuntimeException $exception) {
$data['error'] = $exception->getMessage();
}
}
}
$response = Response::make(json_encode($data), 200);
$response->header('Content-Type', 'application/json');
return $response;
}
示例12: uploadCsv
public function uploadCsv(Request $request)
{
if (Request::isMethod('post')) {
$validator = Validator::make(Input::all(), AdminTool::$uploadCsvRules);
if ($validator->passes()) {
$file = \Request::file('yourcsv');
//the files are stored in storage/app/*files*
$output = Storage::put('yourcsv.csv', file_get_contents($file));
if ($output) {
$this->dispatch(new ImportCSV());
return Redirect::to('admin/uploadcsv')->with('message', 'The following errors occurred')->withErrors('Your file has been successfully uploaded. You will receive an email notification once the import is completed.');
} else {
return Redirect::to('admin/uploadcsv')->with('message', 'The following errors occurred')->withErrors('Something went wrong with your upload. Please try again.');
}
} else {
return Redirect::to('admin/uploadcsv')->with('message', 'The following errors occurred')->withErrors($validator)->withInput();
}
}
return view('admin/uploadcsv');
}
示例13: inventory
/**
* Display a listing of the resource.
*
* @return Response
*/
public function inventory()
{
$member1 = Session::get('brand_userid');
if (!empty($member1)) {
$memberdetail = Brandmember::find($member1);
} else {
$memberdetail = (object) array("email" => "", "fname" => "", "lname" => "");
}
if (Request::isMethod('post')) {
$name = Request::input('name');
$ingradient_name = Request::input('ingradient_name');
$user_email = Request::input('contact_email');
$subject = 'Request for ingredient';
$cmessage = Request::input('request_ing');
$setting = DB::table('sitesettings')->where('name', 'email')->first();
$admin_users_email = $setting->value;
$sent = Mail::send('frontend.inventory.ingredientemail', array('admin_users_email' => $admin_users_email, 'name' => $name, 'ingradient_name' => $ingradient_name, 'email' => $user_email, 'messages' => $cmessage), function ($message) use($admin_users_email, $user_email, $ingradient_name, $subject) {
$message->from($admin_users_email);
$message->to($user_email, $ingradient_name)->cc($admin_users_email)->subject($subject);
});
if (!$sent) {
Session::flash('error', 'something went wrong!! Mail not sent.');
return redirect('inventory');
} else {
Session::flash('success', 'Message is sent to admin successfully. We will getback to you shortly');
return redirect('inventory');
}
}
$start = 'a';
$end = 'z';
$pageindex = array();
for ($i = $start; $i < $end; $i++) {
$inv = DB::table('ingredients')->whereRaw(" name like '" . $i . "%'")->orderBy('name', 'ASC')->get();
$pageindex[$i] = $inv;
}
$inv = DB::table('ingredients')->whereRaw(" name like 'z%'")->orderBy('name', 'ASC')->get();
$pageindex['z'] = $inv;
return view('frontend.inventory.inventory', compact('pageindex', 'memberdetail'), array('title' => 'Miramix Inventory'));
}
示例14: anyBooking
public function anyBooking()
{
$error_msg = [];
$success_msg = [];
$service_types = ServiceTypes::all();
if (Request::isMethod('POST')) {
$rules = ['first_name' => 'required', 'last_name' => 'required', 'email' => 'required', 'phone' => 'required', 'address' => 'required', 'suburb' => 'required', 'city' => 'required', 'booking_date' => 'required', 'service_type_id' => 'required'];
$validator = Validator::make(Input::all(), $rules);
if (!$validator->fails()) {
$booking_date = Input::get('booking_date');
$user_booking_count = Bookings::where('user_id', User::get()->id)->where('pending', 1)->where('booking_date', date('Y-m-d', strtotime($booking_date)))->count();
if ($user_booking_count >= 1) {
$error_msg[] = 'Sorry. Our system shows you have a pending booking. We are currently processing your service booking
and will contact you within 48 hours.';
} else {
$booking = new Bookings(Input::all());
$booking->uid = Uuid::generate()->string;
$booking->user_id = User::get()->id;
$booking->pending = 1;
$booking->booking_date = date('Y-m-d', strtotime(Input::get('booking_date')));
$booking->save();
if ($booking) {
$success_msg[] = 'Great! We have received your service booking. You should be able to hear from us in the next 48 hours.';
} else {
$error_msg[] = 'Whoops! There was an error in your booking. Please try again.';
}
}
} else {
return Redirect::back()->withErrors($validator->messages())->withInput(Input::all());
}
}
if (User::check()) {
return View::make('booking.booking', ['user' => User::get(), 'service_types' => $service_types, 'error_msg' => $error_msg, 'success_msg' => $success_msg]);
} else {
return Redirect::to('/user/login');
}
}
示例15: uploadImage
public function uploadImage(Request $request)
{
$data = null;
if (Request::isMethod('post')) {
$validator = Validator::make(Input::all(), AdminTool::$uploadImageRules);
if ($validator->passes()) {
$file = \Request::file('yourfile');
//the files are stored in storage/app/*files*
$output = Storage::put('yourfile.png', file_get_contents($file));
$cloudinary = ImageManagement::uploader($file);
echo cl_image_tag($cloudinary['url'], array("alt" => "Sample Image"));
echo "<hr />";
dd($cloudinary);
if ($cloudinary) {
return Redirect::to('admin/playground')->with('data', $cloudinary)->with('message', 'The following errors occurred')->withErrors('Your image has uploaded by using Cloudinary.');
} else {
return Redirect::to('admin/playground')->with('message', 'The following errors occurred')->withErrors('Something went wrong with your upload. Please try again.');
}
} else {
return Redirect::to('admin/playground')->with('message', 'The following errors occurred')->withErrors($validator)->withInput();
}
}
return view('admin/testupload', compact($data));
}