Enabling cross-domain communication
To enable us to do cross-domain communication between the frontend and backend, we install the fruitcake/laravel-cors
package. To do this, we run the following command:
composer require fruitcake/laravel-cors
Then, in app/Http/Kernel.php
, we should have the following:
<?php namespace App\Http; use Illuminate\Foundation\Http\Kernel as HttpKernel; class Kernel extends HttpKernel { Â Â Â Â protected $middleware = [ Â Â Â Â Â Â Â Â \App\Http\Middleware\TrustProxies::class, Â Â Â Â Â Â Â Â \Fruitcake\Cors\HandleCors::class, Â Â Â Â Â Â Â Â \App\Http\Middleware\ Â Â Â Â Â Â Â Â Â Â Â PreventRequestsDuringMaintenance::class, Â Â Â Â Â Â Â Â \Illuminate\Foundation\Http\Middleware\ Â Â Â Â Â Â Â Â Â Â Â ValidatePostSize...