#### Category : request

I’ve extended the IlluminateHttpRequest class and am passing it along to my controller. use IlluminateHttpRequest; class MyRequest extends Request { … } Controller class MyController { // Doesnt work public function something(MyRequest $request) { var_dump($request->session()) } // Does work public function something(IlluminateHttpRequest $request) { var_dump($request->session()) } } So when I’m trying to get session $request->session() .. Read more I’am sending parameters from one to another without pasing through route pass them another way for security, but problem last function loses parameter and even dd doesn’t work it returns view only with udefined variable$data. Here is my code in controller: public function show_auth($id) //pass id to test.auth { return view(‘test.auth’,compact(‘id’)); } public function .. Read more I spend hours of time to find out how it works. But no luck. Maybe you can help me? I send a upload with POST request to Laravel. This is my Angular Observable: const formData: FormData = new FormData(); formData.append(‘file_name’, file.name); In Console.log I get file.name and all seems correct. This is my Post: const .. Read more I spend hours of time to find out how it works. But no luck. Maybe you can help me? I send a upload with POST request to Laravel. This is my Angular Observable: const formData: FormData = new FormData(); formData.append(‘file_name’, file.name); In Console.log I get file.name and all seems correct. This is my Post: const .. Read more I spend hours of time to find out how it works. But no luck. I send a upload with POST request to Laravel, but formData.append() in Angular send to RestApi has empty request. Why? This is my Angular Observable: const formData: FormData = new FormData(); formData.append(‘file_name’, file.name); In Console.log I get file.name and all seems .. Read more I am trying to execute form submission into laravel, but the problem is i had to go through the javascript while submitting the form for processing the table data. I wanted a guidance regarding the detailed execution into my case. Is it possible to add more fields into the request before submitting the request to .. Read more I have this validation rule on POST request: public function create(Request$request) { $this->validate($request, [ ‘store_id’ => $request->order_type === OrdersTypeConstants::P2P ? "" : "required|" . ‘exists:stores,id’, …. Sometime it returns The store id field is required even if it is actually being sent as you can see here in the error log: Why could that .. Read more For fun I am trying to figure out different ways of doing things in PHP & Laravel (the version of Laravel I am using is 5.8.37) and I am having trouble when I use the ‘only’ arrow function (->only) on a request object variable. For example, if I do the following to store only certain .. Read more For fun I am trying to figure out different ways of doing things in PHP & Laravel (the version of Laravel I am using is 5.8.37) and I am having trouble when I use the ‘only’ arrow function (->only) on a request object variable. For example, if I do the following to store only certain .. Read more My situation is using Laravel 7 want to use Shopee API Sending request in Laravel should be like this$res = Http::withHeaders([ ‘Content-Type’ => ‘application/json’, ‘Authorization’ => $secret_key ])->post($api_url, [ "ordersn_list" => [$order_no], "shopid" =>$shop_id, "partner_id" => $partner_id, "timestamp" =>$timestamp ]); But Shopee API need no space in body part (cannot send as ..

For example link example.com/profile/23/edit 23 is my id which i want to add in vue component and work with one I saw solving this problem like window.location.href.split(‘/’).pop(); and this case recommended if you are not using vue-router BUT in vue router we work with ApiControllers, but I get current ID from ProfileController (NOT API) When ..

I have a controller that should give permission to use a resource for one IP. If the IP is an invalid controller should give a customized error "Not correct IP". But when executing the controller, I keep getting the customized error "Not correct IP". When I send $request->ip() I get "::1" I am using localhost .. Read more I need a request validation rule to return a custom message upon failure, and since the field being validating is an array with a min:x rule i’d like to have a custom message for both singular and plural variations. I’m just wondering how to pass to the trans_choice() function the :min parameter from the validation .. Read more I’m trying to build a login with passport using an access token and a refresh token: class AuthController extends Controller { const REFRESH_TOKEN = ‘refreshToken’; public function login(Request$request) { $request->validate([ ‘username’ => ‘required|email’, ‘password’ => ‘required’, ]); return$this->proxy(‘password’, [ ‘username’ => $request->username, ‘password’ =>$request->password, ]); } public function proxy($grantType, array$data = ..

i have a question about ajax requests. is there a solution to define a rout just for ajax requests before controller?? i always use a Condition like this in the related method: public function ajaxRequest(Request $request) { if ($request->ajax()) { … } } thanks for your help Source: Laravel Sta..

I’m building an API and trying to give the user the ability to login. At first I was trying to use guzzle: public function login(Request $request) {$http = new GuzzleHttpClient; try { $response =$http->post(config(‘services.passport.login_endpoint’), [ ‘form_params’ => [ ‘grant_type’ => ‘password’, ‘client_id’ => config(‘services.passport.client_id’), ‘client_secret’ => config(‘services.passport.client_secret’), ‘username’ => $request->username, ‘password’ =>$request->password, ..

In my Laravel application (Bootstrap 4, jQuery and Axios) I have a page with multiple forms. Some forms are in a modal, but not all forms. <form method=”post”> <div class=”modal”> // show errors // form fields </div> </form> I will not use ajax for posting this form. What is the best practice to show errors ..

Im having a trouble to show the errors on my view. Im using request, and also i am validating in the controller. This is the part of the view on the code that has errors. @if ($errors->any()) <div class=”col-md-12″> <label>Errores</label> <div class=”alert alert-danger”> <ul> @foreach ($errors->all() as $error) <li>{{$error }}</li> @endforeach </ul> </div> </div> ..