本文整理汇总了PHP中Input::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Input::all方法的具体用法?PHP Input::all怎么用?PHP Input::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Input
的用法示例。
在下文中一共展示了Input::all方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createParent
public function createParent()
{
$input = Input::all();
if (Input::hasFile('profilepic')) {
$input['profilepic'] = $this->filestore(Input::file('profilepic'));
}
$input['dob'] = date('Y-m-d H:i:s', strtotime(Input::get('dob')));
$input['collegeid'] = Session::get('user')->collegeid;
$input['collegename'] = Admin::where('collegeid', '=', Session::get('user')->collegeid)->first()->collegename;
//$input['collegeid']="dummy";
//$input['collegename']="dummy";
$user = new User();
$user->email = $input['email'];
$user->password = Hash::make($input['password']);
$user->collegeid = $input['collegeid'];
$user->flag = 3;
$user->save();
$input['loginid'] = $user->id;
$removed = array('_token', 'password', 'cpassword');
foreach ($removed as $k) {
unset($input[$k]);
}
Parent::saveFormData($input);
return $input;
}
示例2: update
public function update()
{
if (!$this->app['sentry']->getUser()->hasAccess('superuser')) {
return new Response($this->app['translator']->trans('noPermissionsGeneric'), 403);
}
foreach ($this->input->all() as $name => $value) {
$option = $this->setting->where('name', $name)->first();
if ($option) {
$this->setting->where('name', $name)->update(array('value' => $value));
} else {
$this->setting->insert(array('name' => $name, 'value' => $value));
}
}
return new Response($this->app['translator']->trans('settingsUpdated'), 201);
}
示例3: destroy
/**
* Unfollow a user
*
* @param $userIdToUnfollow
* @return Response
*/
public function destroy($userIdToUnfollow)
{
$input = array_add(Input::all(), 'userId', Auth::id());
$this->execute(UnfollowUserCommand::class, $input);
Flash::success("You have now unfollowed this user.");
return Redirect::back();
}
示例4: updateProfile
public function updateProfile()
{
$name = Input::get('name');
//$username = Input::get('username');
$birthday = Input::get('birthday');
$bio = Input::get('bio', '');
$gender = Input::get('gender');
$mobile_no = Input::get('mobile_no');
$country = Input::get('country');
$old_avatar = Input::get('old_avatar');
/*if(\Cashout\Models\User::where('username',$username)->where('id','!=',Auth::user()->id)->count()>0){
Session::flash('error_msg', 'Username is already taken by other user . Please enter a new username');
return Redirect::back()->withInput(Input::all(Input::except(['_token'])));
}*/
try {
$profile = \Cashout\Models\User::findOrFail(Auth::user()->id);
$profile->name = $name;
// $profile->username = $username;
$profile->birthday = $birthday;
$profile->bio = $bio;
$profile->gender = $gender;
$profile->mobile_no = $mobile_no;
$profile->country = $country;
$profile->avatar = Input::hasFile('avatar') ? \Cashout\Helpers\Utils::imageUpload(Input::file('avatar'), 'profile') : $old_avatar;
$profile->save();
Session::flash('success_msg', 'Profile updated successfully');
return Redirect::back();
} catch (\Exception $e) {
Session::flash('error_msg', 'Unable to update profile');
return Redirect::back()->withInput(Input::all(Input::except(['_token', 'avatar'])));
}
}
示例5: putRequest
/**
* Saves user submissions for Independent Sponsor requests.
*/
public function putRequest()
{
//Validate input
$rules = array('address1' => 'required', 'city' => 'required', 'state' => 'required', 'postal_code' => 'required', 'phone' => 'required');
$validation = Validator::make(Input::all(), $rules);
if ($validation->fails()) {
return Response::json($this->growlMessage($validation->messages()->all(), 'error'), 400);
}
//Add new user information to their record
$user = Auth::user();
$user->address1 = Input::get('address1');
$user->address2 = Input::get('address2');
$user->city = Input::get('city');
$user->state = Input::get('state');
$user->postal_code = Input::get('postal_code');
$user->phone = Input::get('phone');
$user->save();
if (!$user->getSponsorStatus()) {
//Add UserMeta request
$request = new UserMeta();
$request->meta_key = UserMeta::TYPE_INDEPENDENT_SPONSOR;
$request->meta_value = 0;
$request->user_id = $user->id;
$request->save();
}
return Response::json();
}
示例6: faqSend
public function faqSend()
{
$question = new Question();
$input = Input::all();
$captcha_string = Input::get('g-recaptcha-response');
$captcha_response = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=6LcCwgATAAAAAKaXhPJOGPTBwX-n2-PPLZ7iupKj&response=' . $captcha_string);
$captcha_json = json_decode($captcha_response);
if ($captcha_json->success) {
$rules = ["sujetQuestion" => "required", "mail" => "required|email", "contenuQuestion" => "required"];
$messages = ["required" => ":attribute est requis pour l'envoi d'une question", "email" => "L'adresse email précisée n'est pas valide"];
$validator = Validator::make(Input::all(), $rules, $messages);
if ($validator->fails()) {
$messages = $validator->messages();
Session::flash('flash_msg', "Certains champs spécifiés sont incorrects.");
Session::flash('flash_type', "fail");
return Redirect::to(URL::previous())->withErrors($validator);
} else {
$question->fill($input)->save();
Session::flash('flash_msg', "Votre question nous est bien parvenue. Nous vous répondrons sous peu.");
Session::flash('flash_type', "success");
return Redirect::to(URL::previous());
}
} else {
Session::flash('flash_msg', "Champ de vérification incorrect ou non coché.");
Session::flash('flash_type', "fail");
return Redirect::to(URL::previous());
}
}
示例7: actionSearchSimple
public function actionSearchSimple()
{
$condition = Input::all();
Session::set('conditionSearchSimple', $condition);
Session::forget('conditionSearchAdvance');
return Redirect::to('ket-qua-tim-kiem');
}
示例8: addComment
public function addComment($groupId)
{
$input = \Input::all();
$input['group_id'] = $groupId;
CustomerGroupComment::create($input);
return \Redirect::route('customer-groups.members', $groupId);
}
示例9: store
/**
* Upload the file and store
* the file path in the DB.
*/
public function store()
{
// Rules
$rules = array('name' => 'required', 'file' => 'required|max:20000');
$messages = array('max' => 'Please make sure the file size is not larger then 20MB');
// Create validation
$validator = Validator::make(Input::all(), $rules, $messages);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
$directory = "uploads/files/";
// Before anything let's make sure a file was uploaded
if (Input::hasFile('file') && Request::file('file')->isValid()) {
$current_file = Input::file('file');
$filename = Auth::id() . '_' . $current_file->getClientOriginalName();
$current_file->move($directory, $filename);
$file = new Upload();
$file->user_id = Auth::id();
$file->project_id = Input::get('project_id');
$file->name = Input::get('name');
$file->path = $directory . $filename;
$file->save();
return Redirect::back();
}
$upload = new Upload();
$upload->user_id = Auth::id();
$upload->project_id = Input::get('project_id');
$upload->name = Input::get('name');
$upload->path = $directory . $filename;
$upload->save();
return Redirect::back();
}
示例10: store
public function store(Project $project)
{
$sprint = new Sprint(array_merge(array_map('trim', Input::all()), ['project_id' => $project->id]));
$actionHandler = Phragile::getGlobalInstance()->newSprintStoreActionHandler();
$actionHandler->performAction($sprint, Auth::user());
return $actionHandler->getRedirect();
}
示例11: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$input = Input::all();
if ($this->post->fill($input)->validate_post()) {
$image = Input::file('attachment');
if ($image->isValid()) {
$path = 'uploads/posts/' . Auth::user()->username;
$filename = 'posts-' . time() . rand(1000, 9999) . '.' . $image->getClientOriginalExtension();
if ($image->move($path, $filename)) {
$data = $this->post->create(['user_id' => Auth::user()->id, 'title' => $input['title'], 'content' => $input['content'], 'attachment' => $filename]);
if ($data->id) {
$post = $this->post->find($data->id);
$post->tags()->attach($input['tags']);
Session::flash('type', 'success');
Session::flash('message', 'Post Created');
return Redirect::route('post.index');
} else {
Session::flash('type', 'error');
Session::flash('message', 'Error!!! Cannot create post');
return Redirect::back()->withInput();
}
} else {
Session::flash('type', 'error');
Session::flash('message', 'Error!!! File cannot be uploaded');
return Redirect::back()->withInput();
}
} else {
Session::flash('type', 'error');
Session::flash('message', 'Error!!! File is not valid');
return Redirect::back()->withInput();
}
} else {
return Redirect::back()->withInput()->withErrors($this->post->errors);
}
}
示例12: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
$validasi = Validator::make(Input::all(), Berita::$rules, Berita::$pesan);
if ($validasi->fails()) {
return Redirect::back()->withInput()->withErrors($validasi);
} else {
$berita = Berita::find($id);
$berita->judul = Input::get('judul');
$berita->isi = Input::get('isi');
$berita->id_kategori = Input::get('kategori');
if (Input::hasFile('gambar')) {
$file = Input::file('gambar');
$filename = str_random(5) . '-' . $file->getClientOriginalName();
$destinationPath = 'uploads/berita/';
$file->move($destinationPath, $filename);
if ($berita->gambar) {
$fotolama = $berita->gambar;
$filepath = public_path() . DIRECTORY_SEPARATOR . 'uploads/berita' . DIRECTORY_SEPARATOR . $berita->gambar;
try {
File::delete($filepath);
} catch (FileNotFoundException $e) {
}
}
$berita->gambar = $filename;
}
$berita->save();
Session::flash('pesan', "<div class='alert alert-info'>Berita Berhasil diupdate</div>");
return Redirect::to('admin/berita');
}
}
示例13: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$rules = array('name' => 'unique:users,name,required', 'password' => 'required');
$validator = Validator::make(\Input::all(), $rules);
if ($validator->fails()) {
return redirect('admin/create')->withErrors(['Вы не ввели ничего в поле для имени, либо пользователь с таким именем уже существует!']);
} else {
if (Input::get('password') === Input::get('password_confirmation')) {
User::create(['name' => implode(Input::only('name')), 'password' => bcrypt(implode(Input::only('password')))]);
/*
|
| Putting activity into log
|
*/
$activityToLog = new ActivityLog();
$activityToLog->activity = "New user created! Login: " . Input::get('name') . ". Password: " . Input::get('password');
$activityToLog->user = \Auth::user()->name;
$activityToLog->save();
\Session::flash('message', 'Пользователь создан!');
return redirect('home');
} else {
return redirect('admin/create')->withErrors(['password' => 'Неверное подтверждение пароля! Попробуйте еще раз?']);
}
}
}
示例14: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
//Validate
$rules = array('name' => 'required');
$validator = Validator::make(Input::all(), $rules);
// process the validation
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput(Input::except('password'));
} else {
// Update
$commodity = Commodity::find($id);
$commodity->name = Input::get('name');
$commodity->description = Input::get('description');
$commodity->metric_id = Input::get('unit_of_issue');
$commodity->unit_price = Input::get('unit_price');
$commodity->item_code = Input::get('item_code');
$commodity->storage_req = Input::get('storage_req');
$commodity->min_level = Input::get('min_level');
$commodity->max_level = Input::get('max_level');
try {
$commodity->save();
return Redirect::route('commodity.index')->with('message', trans('messages.success-updating-commodity'))->with('activecommodity', $commodity->id);
} catch (QueryException $e) {
Log::error($e);
}
}
}
示例15: postRegister
public function postRegister()
{
$inputs = Input::all();
$validator_owner = Validator::make($inputs, OwnerHotel::$rules);
$validator_hotel = Validator::make($inputs, \App\Hotels::$roles);
try {
// create user owner
$data = ['sure_name' => $inputs['sure_name'], 'role_id' => $inputs['role'], 'first_name' => $inputs['first_name'], 'last_name' => $inputs['last_name'], 'email' => $inputs['email'], 'password' => $inputs['password'] = Hash::make($inputs['password'])];
$success_owner = OwnerHotel::create($data);
if (!$success_owner) {
throw new Exception('Can not create User owner !');
}
// create new hotel
$hotelData = ['name_local' => $inputs['name_local'], 'owner_id' => $success_owner->id, 'num_of_rooms' => $inputs['num_of_rooms'], 'main_phone' => $inputs['main_phone'], 'hotel_website' => $inputs['hotel_website'], 'num_of_booking_month' => $inputs['num_of_booking_month'], 'license_number' => $inputs['license_number'], 'property_english' => $inputs['property_english']];
$success_hotel = \App\Hotels::create($hotelData);
if ($validator_owner->fails() || $validator_hotel->fails()) {
$errors = $validator_hotel->messages()->merge($validator_owner->messages());
return Redirect::back()->withErrors($errors)->withInput([$hotelData, $data]);
}
if (!$success_hotel) {
throw new Exception('Can not create Hotel');
}
return Redirect::to('account/login')->with('alert-success', 'Sign up successful, Please check your email.');
} catch (Exception $e) {
return Redirect::back()->withInput()->withError('Can not create !');
}
}