本文整理汇总了PHP中Illuminate\Support\Facades\Request::input方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::input方法的具体用法?PHP Request::input怎么用?PHP Request::input使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\Request
的用法示例。
在下文中一共展示了Request::input方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
/**
* Show the application welcome screen to the user.
*
* @return Response
*/
public function create(Request $request, $id = '')
{
//echo Auth::user()->id; exit;
if (empty($id)) {
$model = new \App\Models\Post();
} else {
$model = \App\Models\Post::find($id);
if (is_null($model)) {
return response()->view('errors.404', array(), 404);
}
}
if ($request->isMethod('post')) {
$this->validate($request, ['title' => 'required|max:255', 'content' => 'required']);
$title = \Illuminate\Support\Facades\Request::input('title');
$content = \Illuminate\Support\Facades\Request::input('content');
$publish = \Illuminate\Support\Facades\Request::input('publish') === null ? 0 : 1;
if (empty($id)) {
\App\Models\Post::create(array('title' => $title, 'content' => $content, 'publish' => $publish, 'user_id' => (int) Auth::user()->id, 'created_at' => date('Y-m-d H:i:s')));
} else {
$model->fill(['title' => $title, 'content' => $content, 'publish' => $publish, 'updated_at' => date('Y-m-d H:i:s')]);
$model->save();
}
//echo "23423"; exit;
return redirect()->to('/');
}
return view('post.create')->with(compact('model'));
}
示例2: search
public function search()
{
$kata_kunci = Request::input('kata_kunci');
$employees = employees::where('nama', 'like', '%' . $kata_kunci . '%')->orWhere('nip', 'like', '%' . $kata_kunci . '%')->paginate(9);
$employees->setPath('search');
return View('books.search')->with('employees', $employees);
}
示例3: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$obj = new helpers();
$memberUpdate = Request::all();
if ($memberUpdate['password'] == '') {
unset($memberUpdate['password']);
} else {
$memberUpdate['password'] = Hash::make(Request::input('password'));
}
if (isset($_FILES['pro_image']['name']) && $_FILES['pro_image']['name'] != "") {
$destinationPath = 'uploads/member/';
// upload path
$thumb_path = 'uploads/member/thumb/';
$medium = 'uploads/member/thumb/';
$extension = Input::file('pro_image')->getClientOriginalExtension();
// getting image extension
$fileName = rand(111111111, 999999999) . '.' . $extension;
// renameing image
Input::file('pro_image')->move($destinationPath, $fileName);
// uploading file to given path
$obj->createThumbnail($fileName, 661, 440, $destinationPath, $thumb_path);
$obj->createThumbnail($fileName, 116, 116, $destinationPath, $medium);
} else {
$fileName = '';
}
if ($fileName == '') {
unset($memberUpdate['pro_image']);
} else {
$memberUpdate['pro_image'] = $fileName;
}
$member = Brandmember::find($id);
$member->update($memberUpdate);
Session::flash('success', 'Member updated successfully');
return redirect('admin/member');
}
示例4: 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'));
}
示例5: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//$token = Input::post('token');
if (Request::has('token')) {
$token = Request::input('token');
$compare = GlobalLibrary::compareToken($token);
if ($compare) {
$fullname = Request::input('f');
$username = Request::input('u');
$phone = Request::input('pn');
$email = Request::input('e');
$password = Request::input('pwd');
$roles = Request::input('r');
$field_users = array('name' => $username, 'email' => $email, 'password' => bcrypt($password));
$count_users = User::where('email', '=', $email)->count();
if ($count_users <= 0) {
$user = User::create($field_users);
$user_login = User::where('email', '=', $email)->first();
foreach ($user_login as $key => $value) {
$id = $user_login->id;
}
$field_user_detail = array('users_id' => $id, 'users_name' => $username, 'users_fullname' => $fullname, 'users_group_id' => $roles, 'users_email' => $email, 'users_status_id' => '1');
$user = table_users_detail::create($field_user_detail);
return (new Response(array('status' => true, 'msg' => 'Register successfully'), 200))->header('Content-Type', "json");
} else {
return (new Response(array('status' => false, 'msg' => 'Email already registered'), 200))->header('Content-Type', "json");
}
} else {
return (new Response(array('status' => false, 'msg' => 'Authentication Failed 2'), 200))->header('Content-Type', "json");
}
} else {
return (new Response(array('status' => false, 'msg' => 'Authentication Failed 1'), 200))->header('Content-Type', "json");
}
}
示例6: sendMail
/**
* Used to send mail from the email editor defined.
*
* @author Sinthujan G.
* @return mixed Redirects to the view with Error or Success messages.
*/
public function sendMail()
{
$dets = array('msg' => Request::input('mailDets'), 'subject' => Request::input('subjectH'), 'to' => Request::input('toH'), 'file' => Request::file('file'));
$rules = array('msg' => 'required', 'subject' => 'required', 'to' => 'required|email');
$messages = array('msg.required' => 'The email body is required', 'to.required' => 'The recipient\'s address is required', 'to.email' => 'The recepient address is not of the correct format');
$validator = Validator::make($dets, $rules, $messages);
if ($validator->fails()) {
// send back to the page with the input data and errors
return Redirect::back()->withInput()->withErrors($validator);
} else {
//Get the details from the form and send it as an array to the function.
Mail::send(array(), array(), function ($message) use($dets) {
$message->from('paintbuddyProj@gmail.com', 'PaintBuddy Team');
$message->to($dets['to']);
$message->subject($dets['subject']);
$message->setBody($dets['msg'], 'text/html');
if (isset($dets['file'])) {
$message->attach(Request::file('file'), ['as' => Request::file('file')->getClientOriginalName(), 'mime' => Request::file('file')->getClientOriginalExtension()]);
}
});
if (count(Mail::failures()) > 0) {
return Redirect::back()->withInput()->withErrors('Mail was not sucessfully sent. Please try again');
} else {
return Redirect::back()->with('success', true)->with('message', 'Mail sucessfully sent');
}
}
}
示例7: createUsers
public function createUsers()
{
$inputs = Request::all();
$userTypes = Request::get('userType');
// Checking permission of user before creating new users
$emails = json_decode(Request::input('users'));
foreach ($emails as $email) {
Log::info('username - ' . $email);
$password = str_random(10);
DB::table('users')->insert(['name' => $email, 'email' => $email, 'password' => bcrypt($password), 'type' => 'caller']);
foreach ($userTypes as $userType) {
// Making a 'userType' user
$user = \App\User::where('name', '=', $email)->first();
$caller = \App\Role::where('name', '=', $userType)->first();
// role attach alias
$user->attachRole($caller);
// parameter can be an Role object, array, or id
}
$data = array('name' => $email, 'username' => $email, 'password' => $password);
// Would sent a link to the user to activate his account
// $this->sendLink($email);
// \Mail::send('mail.email', $data, function ($message) use ($data) {
// $message->subject('Login Details ')
// ->to('manish.dwibedy@gmail.com');
// });
}
return view('create-users', ['page' => 'create-users']);
}
示例8: postUserSettings
public function postUserSettings()
{
$error = false;
if (Request::has('user_id')) {
$user_id = (int) Auth::user()->user_id;
$input_id = (int) Request::input('user_id');
if (Request::input('roles') === null) {
$roles = [];
} else {
$roles = Request::input('roles');
}
if ($user_id === $input_id && !in_array(env('ROLE_ADMIN'), $roles, false)) {
$roles[] = env('ROLE_ADMIN');
$error = true;
}
$editUser = User::find(Request::input('user_id'));
$editUser->roles()->sync($roles);
$editUser->save();
$this->streamingUser->update();
}
if ($error) {
return redirect()->back()->with('error', 'Vous ne pouvez pas enlever le droit admin de votre compte!');
}
return redirect()->back();
}
示例9: destroy
/**
* Remove position
*
* @param int $id
* @return string
*/
public function destroy()
{
$position = Position::find(Request::input('id'));
$position->delete();
$item = array("id" => $position->id, "name" => $position->name, "description" => $position->description);
echo json_encode($item);
}
示例10: anyIndex
public function anyIndex()
{
//获取路由传入的参数
//echo Route::input('name');
//获取配置信息
$value = config('app.timezone');
//var_dump($value);
//获取请求输入 http://host-8/web/user?name=dfse 输出:dfse
$name1 = Request::has('name') ? Request::get('name') : '';
//取得特定输入数据,若没有则取得默认值
$name2 = Request::input('name', '默认值');
$input = Request::all();
//所有的
$input = Request::input('products.0.name');
//重定向
//return redirect('login');
//获取cookie
$value = Request::cookie('name');
//获取域名
$url = Request::root();
// echo $url;
$data = ['url' => $url, 'name1' => $name1, 'name2' => $name2, 'value' => $value];
//响应视图 响应最常用的几个方法:make/view/json/download/redirectTo
return response()->view('user.user', $data);
}
示例11: postSearch
/**
* Search for elements within a Business.
*
* @param Timegridio\Concierge\Models\Business $business
*
* @return Illuminate\View\View
*/
public function postSearch(Business $business)
{
$this->authorize('manage', $business);
$criteria = Request::input('criteria');
$search = new SearchEngine($criteria);
$search->setBusinessScope([$business->id])->run();
return view('manager.search.index')->with(['results' => $search->results(), 'criteria' => $criteria]);
}
示例12: postDestroy
/**
* 删除数据
* @return mixed
*/
public function postDestroy()
{
$res = $this->bindModel->destroy(Request::input('ids', []));
if ($res === false) {
return Response::returns(['alert' => alert(['content' => '删除失败!'], 500)]);
}
return ['alert' => alert(['content' => '删除成功!'])];
}
示例13: bootAuthResourceOwner
/**
* Make the current resource owner (access_token or Authorization header)
* the current authenticated user in Laravel.
*
* @return void
*/
protected function bootAuthResourceOwner()
{
if (config('api.auth_resource_owner', true) && !Auth::check() && Request::input('access_token', Request::header('Authorization'))) {
if ($user_id = Authentication::instance()->userId()) {
Auth::onceUsingId($user_id);
}
}
}
示例14: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\View\View
*/
public function index()
{
$page = Request::input('page');
$perPage = config('typicms.tags.per_page');
$data = $this->repository->byPage($page, $perPage, ['translations']);
$models = new Paginator($data->items, $data->totalItems, $perPage, null, ['path' => Paginator::resolveCurrentPath()]);
return view('tags::public.index')->with(compact('models'));
}
示例15: rebuildPassword
public function rebuildPassword()
{
try {
User::where('email', Request::input('email'))->where('remember_token', Request::input('remember_token'))->update(['password' => bcrypt(Request::input('password'))]);
} catch (\Exception $e) {
}
return redirect('/login');
}