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...