本文整理汇总了PHP中Illuminate\Support\Facades\Input::only方法的典型用法代码示例。如果您正苦于以下问题:PHP Input::only方法的具体用法?PHP Input::only怎么用?PHP Input::only使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\Input
的用法示例。
在下文中一共展示了Input::only方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Update the specified resource in storage.
*
* @param int $id
*
* @return Response
*/
public function update($id = null)
{
$user = Auth::user();
$input = Input::only('location', 'website', 'bio', 'twitter', 'facebook', 'github', 'cover', 'image', 'notify_articles');
$user->profile()->update($input);
return Redirect::route('user-package::profile.show');
}
示例2: veritranscc
/**
* Veritrans Credit Card
*
* 1. Check Order
* 2. Save Payment
*
* @return Response
*/
public function veritranscc()
{
if (!Input::has('order_id')) {
return new JSend('error', (array) Input::all(), 'Tidak ada data order id.');
}
$errors = new MessageBag();
DB::beginTransaction();
//1. Validate Sale Parameter
$order = Input::only('order_id', 'gross_amount', 'payment_type', 'masked_card', 'transaction_id');
//1a. Get original data
$sale_data = \App\Models\Sale::findorfail($order['order_id']);
//2. Save Payment
$paid_data = new \App\Models\Payment();
$payment['transaction_id'] = $sale_data['id'];
$payment['method'] = $order['payment_type'];
$payment['destination'] = 'Veritrans';
$payment['account_name'] = $order['masked_card'];
$payment['account_number'] = $order['transaction_id'];
$payment['ondate'] = \Carbon\Carbon::parse($order['transaction_time'])->format('Y-m-d H:i:s');
$payment['amount'] = $order['gross_amount'];
$paid_data = $paid_data->fill($payment);
if (!$paid_data->save()) {
$errors->add('Log', $paid_data->getError());
}
if ($errors->count()) {
DB::rollback();
return response()->json(new JSend('error', (array) Input::all(), $errors), 404);
}
DB::commit();
$final_sale = \App\Models\Sale::id($sale_data['id'])->with(['voucher', 'transactionlogs', 'user', 'transactiondetails', 'transactiondetails.varian', 'transactiondetails.varian.product', 'paidpointlogs', 'payment', 'shipment', 'shipment.address', 'shipment.courier', 'transactionextensions', 'transactionextensions.productextension'])->first()->toArray();
return response()->json(new JSend('success', (array) $final_sale), 200);
}
示例3: updateversion
/**
* Tracker update application
*
* 1. Check input
* 2. Check auth
* 3. Set current absence
* @return Response
*/
function updateversion()
{
$attributes = Input::only('application');
//1. Check input
if (!$attributes['application']) {
return Response::json('101', 200);
}
if (!isset($attributes['application']['api']['client']) || !isset($attributes['application']['api']['secret']) || !isset($attributes['application']['api']['tr_ver']) || !isset($attributes['application']['api']['station_id']) || !isset($attributes['application']['api']['email']) || !isset($attributes['application']['api']['password'])) {
return Response::json('102', 200);
}
//2. Check auth
$client = \App\Models\Api::client($attributes['application']['api']['client'])->secret($attributes['application']['api']['secret'])->workstationaddress($attributes['application']['api']['station_id'])->with(['branch'])->first();
if (!$client) {
$filename = storage_path() . '/logs/appid.log';
$fh = fopen($filename, 'a+');
$template = date('Y-m-d H:i:s : Login : ') . json_encode($attributes['application']['api']) . "\n";
fwrite($fh, $template);
fclose($fh);
return Response::json('402', 200);
}
//3. Set current absence
if ((double) $attributes['application']['api']['tr_ver'] < (double) Config::get('current.absence.version')) {
return Response::json('sukses|' . Config::get('current.absence.url1') . '|' . Config::get('current.absence.url2'), 200);
}
return Response::json('200', 200);
}
示例4: index
/**
* Display a listing of the available mosques.
*
* Possible filters, as GET params, are:
* cityId: optional, numeric only
* stateId, goes with placeId
* latitude, optional, should not be set if placeId is set
* longitude, goes with Latitude
* minPrayerTimeUtc: optional, HH:MM 24 hours format, e.g 13:20
* maxPrayerTimeUtc: optional, HH:MM 24 hours format, e.g 14:00
* minInteriorSpace: optional, integer [1-5]
* minParkingSpace: optional, integer [1-5]
*
* @return Response
*/
public function index()
{
$filters = Input::only('cityId', 'stateId', 'latitude', 'longitude', 'minPrayerTimeUtc', 'maxPrayerTimeUtc', 'minInteriorSpace', 'minParkingSpace');
$validator = Validator::make($filters, ['minPrayerTimeUtc' => 'date_format:H:i', 'maxPrayerTimeUtc' => 'date_format:H:i', 'minInteriorSpace' => 'numeric|between:1,5', 'minParkingSpace' => 'numeric|between:1,5', 'cityId' => 'integer', 'stateId' => 'integer', 'latitude' => 'numeric|between:-90,90|required_with:longitude', 'longitude' => 'numeric|between:-180,180|required_with:latitude']);
if ($validator->fails()) {
throw new BadRequestException($validator->errors()->first());
}
$request = Mosque::query();
if ($filters['cityId'] != null) {
$request->where('city', $filters['cityId']);
}
if ($filters['stateId'] != null) {
$request->where('state', $filters['stateId']);
}
if ($filters['minInteriorSpace'] != null) {
$request->where('interior_space', '>=', $filters['minInteriorSpace']);
}
if ($filters['minParkingSpace'] != null) {
$request->where('parking_space', '>=', $filters['minParkingSpace']);
}
if ($filters['minPrayerTimeUtc'] != null) {
$request->where('prayer_start', '>=', $filters['minPrayerTimeUtc']);
}
if ($filters['maxPrayerTimeUtc'] != null) {
$request->where('prayer_start', '<=', $filters['maxPrayerTimeUtc']);
}
if ($filters['latitude'] != null && $filters['longitude'] != null) {
$request->whereBetween('latitude', [$filters['latitude'] - 0.04, $filters['latitude'] + 0.04]);
$request->whereBetween('longitude', [$filters['longitude'] - 0.04, $filters['longitude'] + 0.04]);
}
$mosques = $request->get();
return Response::json(array('data' => $mosques, 'status_code' => 200, 'params' => $filters), 200, [], JSON_NUMERIC_CHECK);
}
示例5: update
public function update(SubscriptionService $subscriptionService, DeltaVCalculator $deltaV, $object_id)
{
if (Input::has(['status', 'visibility'])) {
$object = Object::find($object_id);
if (Input::get('status') == ObjectPublicationStatus::PublishedStatus) {
DB::transaction(function () use($object, $subscriptionService, $deltaV) {
// Put the necessary files to S3 (and maybe local)
if (Input::get('visibility') == VisibilityStatus::PublicStatus) {
$object->putToLocal();
}
$job = (new PutObjectToCloudJob($object))->onQueue('uploads');
$this->dispatch($job);
// Update the object properties
$object->fill(Input::only(['status', 'visibility']));
$object->actioned_at = Carbon::now();
// Save the object if there's no errors
$object->save();
// Add the object to our elasticsearch node
Search::index($object->search());
// Create an award wih DeltaV
$award = Award::create(['user_id' => $object->user_id, 'object_id' => $object->object_id, 'type' => 'Created', 'value' => $deltaV->calculate($object)]);
// Once done, extend subscription
$subscriptionService->incrementSubscription($object->user, $award);
});
} elseif (Input::get('status') == "Deleted") {
$object->delete();
}
return response()->json(null, 204);
}
return response()->json(false, 400);
}
示例6: store
/**
* Create a new quicksolver user if validation of user data succeeds.
* Confirmation mail with confirmation code is send to new user.
*
* @return link to redirect after validation of user data
*/
public function store()
{
/*
* Rules for user data
*/
$rules = ['username' => 'required|min:6|unique:users', 'email' => 'required|email|unique:users', 'password' => 'required|confirmed|min:8'];
/*
* Validation of input data based on validation rules
*/
$validator = Validator::make(Input::only('username', 'email', 'password', 'password_confirmation'), $rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator);
}
// Confirmation code is a random value
$confirmation_code = str_random(30);
/*
* User will be created in db, when data is valid
*/
User::create(['username' => Input::get('username'), 'email' => Input::get('email'), 'password' => Hash::make(Input::get('password')), 'confirmation_code' => $confirmation_code]);
/*
* Mail based on view 'registrationmail' including the confirmation code will be sent to user
*/
Mail::send('pages.registrationmail', compact('confirmation_code'), function ($message) {
$message->to(Input::get('email'))->subject('Confirm your Quicksolver account!');
});
/*
* Redirect user to home - page and show flash message for information
*/
Session::flash('message', 'Thanks for signing up to Quicksolver! Please check your mails and follow the instructions to complete the sign up procedure');
return Redirect::home();
}
示例7: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update($id)
{
$user = User::findOrFail($id);
$data = Input::only('id', 'name', 'password');
$user->update($data);
return Redirect::route('users.index');
}
示例8: store
public function store()
{
if (Auth::attempt(Input::only('email', 'password'))) {
return redirect()->route('admin');
}
return Redirect::back()->withInput();
}
示例9: doRegister
public function doRegister()
{
$rules = array('password' => 'required|alpha_num|min:3', 'username' => 'required|min:3', 'firstName' => 'required', 'lastName' => 'required');
// run the validation rules on the inputs from the form
$validator = Validator::make(Input::all(), $rules);
// if the validator fails, redirect back to the form
if ($validator->fails()) {
return Redirect::to('register')->withErrors($validator)->withInput(Input::except('password'));
// send back the input (not the password) so that we can repopulate the form
} else {
$credentials = Input::only('firstName', 'lastName', 'username', 'password');
$credentials['password'] = Hash::make($credentials['password']);
try {
$user = User::create($credentials);
} catch (Exception $e) {
return Response::json(['error' => 'User already exists.'], Illuminate\Http\Response::HTTP_CONFLICT);
}
$userdata = array('username' => Input::get('username'), 'password' => Input::get('password'));
if (Auth::attempt($userdata)) {
// validation successful!
// redirect them to the secure section or whatever
// return Redirect::to('secure');
// for now we'll just echo success (even though echoing in a controller is bad)
return Redirect::to('/');
} else {
// validation not successful
return Redirect::to('/');
}
}
}
示例10: send
/**
* Process the second intermediate contact form.
*/
public function send()
{
$input = Input::only(array('name', 'email', 'comment', 'to_email', 'to_name', 'security-code'));
$input['security-code'] = $this->quickSanitize($input['security-code']);
if (strlen($input['security-code']) < 2) {
$message = "Please enter the security code again. Thank you!";
return view('lasallecmscontact::step_two_form', ['input' => $input, 'message' => $message]);
}
// Guess it couldn't hurt to run inputs through the quick sanitize...
$input['name'] = $this->quickSanitize($input['name']);
$input['email'] = $this->quickSanitize($input['email']);
$input['comment'] = $this->quickSanitize($input['comment']);
// The "to_email" comes from the LaSalleCRMContact package. If it contains an email address,
// then the contact form was filled out in that package. So, let's figure out the "to" email
$to_email = Config::get('lasallecmscontact.to_email');
$to_name = Config::get('lasallecmscontact.to_name');
if ($input['to_email'] != "") {
$to_email = $input['to_email'];
$to_name = $input['to_name'];
}
Mail::send('lasallecmscontact::email', $input, function ($message) use($to_email, $to_name) {
$message->from(Config::get('lasallecmscontact.from_email'), Config::get('lasallecmscontact.from_name'));
$message->to($to_email, $to_name)->subject(Config::get('lasallecmscontact.subject_email'));
});
// Redir to confirmation page
return Redirect::route('contact-processing.thankyou');
}
示例11: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$input = Input::only('first_name', 'last_name', 'email', 'password');
$command = new CreateNewUserCommand($input['email'], $input['first_name'], $input['last_name'], $input['password']);
$this->commandBus->execute($command);
return Redirect::to('/profile');
}
示例12: postLogin
public function postLogin(LoginRequest $request)
{
$remember = (bool) Input::get('remember');
if (Auth::attempt(Input::only('email', 'password'), $remember)) {
return redirect()->intended('admin');
}
return redirect()->back();
}
示例13: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$input = Input::only('email', 'password');
if (Auth::attempt($input)) {
return Redirect::intended('/profile');
}
return Redirect::back()->withFlashMessage('E-mail Address and/or Password incorrect');
}
示例14: signin
public function signin()
{
$credentials = Input::only('email', 'password');
if (!($token = JWTAuth::attempt($credentials))) {
return Response::json(false, HttpResponse::HTTP_UNAUTHORIZED);
}
return Response::json(compact('token'));
}
示例15: recover_password
public function recover_password()
{
switch ($response = Password::remind(Input::only('email'))) {
case Password::INVALID_USER:
return Response::json(['error' => 'E-mail no registrado.'], 200);
case Password::REMINDER_SENT:
return Response::json(['success' => 1], 200);
}
}