Category : http

when I want to add product to cart, before I redirect to Cart I got this message : HTTP/1.0 302 Found Cache-Control: no-cache. private Date: Sat, 27 Feb 2021 Location: http://127.0.0.1:8000/cart Redirecting to http://127.0.0.1:8000/cart in laravel This is route for add to cart : Route::post(‘add/{product}’, ‘[email protected]’)->name(‘cart.add’); And this is redirect in addToCart controller : return ..

Read more

The Problem: After successful initial "csrf-cookie" and "login" requests, the authenticated user seems to disappear from the session on all subsequent requests. $request->user() and Auth::user() and auth()-user() all return null. $request->session()->all() returns just a "_token" field, and $request->session()->has(‘users’) and $request->session()->has(‘user’) both return false. Context: This only occurs on my production server (I’ve tried both a ..

Read more

The Problem: After successful initial "csrf-cookie" and "login" requests, the authenticated user seems to disappear from the session on all subsequent requests. $request->user() and Auth::user() and auth()-user() all return null. $request->session()->all() returns just a "_token" field, and $request->session()->has(‘users’) and $request->session()->has(‘user’) both return false. Context: This only occurs on my production server (I’ve tried both a ..

Read more

Problem: I am trying to get the content / body from a text/plain POST request in a Controller in Laravel 8. Nothing in the docs or numerous google searches worked. I have tried: $request->input(); $request->all(); $request->json(); json_encode($request); All of these seem to show that the request is completely empty. Context This may not be relevant ..

Read more

I create new own command in laravel, which updates some rows in mysql (in this case minecraft servers): public function handle() { $serversList = [ ‘cubegame.pl’, ‘dermc.pl’, ‘feerko.pl’, ‘skyup.pl’, ‘mcosada.pl’, ‘dragon-craft.pl’, ‘gc2.pl’ ]; foreach ($serversList as $server) { $req = Http::get("https://api.mcsrvstat.us/2/$server"); if($req->ok()) { $status = $req->json(); echo( $status[‘motd’][‘html’][0] ); // $serv = Server::updateOrCreate( // [ ..

Read more

I’m trying to query the passport /oauth/clients endpoint from my backend php and I am using this code $response = Http::get(config(‘app.url’) .’/oauth/clients’); where my app.url is set to http://homestead.test (for development purposes). If I navigate to that endpoint in my browser I get an array of clients as expected but as soon as I try ..

Read more

I am creating HTTP tests for an existing laravel application as described in the docs. The tests look something like this: public function testSomething() { $this->get(‘/something’)->assertOk(); } The app has some endpoints that use the HTTP SEARCH method, declared like this: Route::addRoute(‘SEARCH’, ”, ‘[email protected]’); However, the test class doesn’t have a search(‘/something’) method. Is there ..

Read more

500 (Internal Server Error) when I try to submit user data to laravel. Actually it stores data fine if I execute in laravel: User::create($request->all()) So it means the connection between client and server is alright. Angular @Component({ selector: ‘app-register’, templateUrl: ‘./register.component.html’, styleUrls: [‘./register.component.css’] }) export class RegisterComponent implements OnInit { form: FormGroup; constructor(private fb: FormBuilder, ..

Read more

Authenticate web using Laravel Passport I’m Redirecting the Response by specifying the access token as a Bearer token in the Authorization header to the route. And getting below error. IlluminateAuthAuthenticationException: Unauthenticated. File: Controller.php $id = ‘1’; $accessToken = ‘passport_token_value’; return redirect(‘home/id=’.$id)->header(‘Authorization’, ‘Bearer ‘.$accessToken); I have assigned Laravel Passport custom middleware to protect and authenticate different ..

Read more

Yes I understand there is an excess of limit. But I need to get the status code, not the error way. Instead, it throws this message at me. How can I get the HTTP status code? return $response->getStatusCode(); This error comes; GuzzleHttpExceptionClientException Client error: `GET https://api.envato.com/v3/market/author/sale?code=xxxxxx-xxxx-xxxx-xx` resulted in a `429 Too Many Requests` response: {"error": ..

Read more

I am trying to run function from route name profile function is given below. class Profile extends Controller { function data(){ $data = Http::get(‘http://hris.kseb.in/osvtest/ksebltws/api.php/usrp/validateConsumerWS’)->body(); } When I am running this it does display anything on screen but for simple echo like this class Profile extends Controller { function data(){ $data = Http::get(‘http://hris.kseb.in/osvtest/ksebltws/api.php/usrp/validateConsumerWS’)->body(); } It redirecting ..

Read more

I set up a new project and everything is running properly but I am having this problem. At web.php, there is an error message: Auth::routes is highlighted. Error – Undefined type ‘Auth’. I followed the commands to create a PagesController at Controller and it was successfully done. At PagesController, I keyed in a function: public ..

Read more

I am trying to get a object using the relations in laravel. In my project, 1 instalation belongs to 1 project and 1 project can have many installations. In the migration i have coded like this: Projects: Schema::create(‘projects’, function (Blueprint $table) { $table->id(); $table->bigInteger(‘user_id’)->unsigned(); $table->string(‘name’); $table->boolean(‘removed’); $table->timestamps(); $table->foreign(‘user_id’)->references(‘id’)->on(‘users’); }); Installations: Schema::create(‘installations’, function (Blueprint $table) { ..

Read more

Forcing to redirect URI from http to https using Laravel 5.4 on Heroku Method I used to solve this problem: APP_URL: https://stackoverflow.com/a/45891292/6607216 MiddleWare: https://stackoverflow.com/a/45858789/6607216 Proxies: https://gist.github.com/ilhamsj/819369a56bb983eac018c5f4e04cda50 I tried to upgrade Laravel version to 5.6 and 5.8 but no luck also. Kind of wondering if Heroku is blocking something to privent redirect from http to https. ..

Read more

I have this parameter sent to my server from a bigbluebutton webhook request, but i can’t seem to parse it into json, object, array, or something to access the data inside it. [{"data":{"type":"event","id":"user-presenter-assigned","attributes":{"meeting":{"internal-meeting-id":"874459b8178f4675df2278cb5aa49e9c263bc9cb-1603783168934","external-meeting-id":"6fa144e60fe591f82755e93c9937050dd06be266"},"user":{"internal-user-id":"w_qyus3pijthsu","external-user-id":"w_qyus3pijthsu"}},"event":{"ts":1603783173048}}}] public function event_happened(Request $request){ $event = $request->event; $decoded = json_decode($event); return $decoded[0][‘data’]; //returns error (Error: Cannot use object of type stdClass as ..

Read more

I’ve got Laravel backend and I’m trying to make iOS to it, but there is no documentation. It is my first time with Laravel, so confused with the routes and middlewares. How do I compose URL from code below Route::middleware(‘auth:api’)->get(‘/user’, function (Request $request) { return $request->user(); }); // Passport authentication Route::group([ ‘prefix’ => ‘auth’ ], ..

Read more

laravel : 7.28.0 "php": "^7.2.5" When I enter any link it gives the following errors: SymfonyComponentHttpKernelExceptionNotFoundHttpException in /home/mick/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:1064 and SymfonyComponentHttpKernelExceptionNotFoundHttpException in /home/mick/vendor/laravel/framework/src/Illuminate/Routing/AbstractRouteCollection.php:43 route files api.php -> Empty web.php Route::get(‘/’, ‘[email protected]’)->name(‘home’); Route::get(‘/clear’, ‘[email protected]’)->name(‘clear_cache’); Route::get(‘/installations’, ‘[email protected]’)->name(‘installations’); Route::get(‘/installations/step/2’, ‘[email protected]’)->name(‘installations_step_two’); Route::post(‘/installations/step/2’, ‘[email protected]’); Route::get(‘/installations/step/final’, ‘[email protected]’)->name(‘installation_final’); /** * Authentication */ Route::get(‘/login’, ‘[email protected]’)->name(‘login’)->middleware(‘guest’); Route::post(‘/login’, ‘[email protected]’); Route::any(‘/logout’, ‘[email protected]’)->name(‘logout’); Route::get(‘/register’, ‘[email protected]’)->name(‘register’)->middleware(‘guest’); Route::post(‘/register’, ‘[email protected]’); Route::get(‘/forgot-password’, ..

Read more

I am trying to build a sms notification using laravel, I want to execute a http url once i hit the function on a laravel’s controller with this code public function sendSMS() { return ‘https://api.smsglobal.com/http-api.php?action=sendsms&user=testuser&password=secret&from=Test&to=61447100250&text=Hello%20world’ } Am expecting this to execute the url to send the sms notification but with no avail, it will be ..

Read more