How to disable CSRF Token in Laravel (Development – PostMan test)

You can disable it in app/http/Kernel.php in the web-Middleware group.

‘web’ => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
//\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],

 

https://stackoverflow.com/questions/37806762/how-to-disable-csrf-token-in-laravel-and-why-we-have-to-disable-it

Laravel – RESTful Resource controller

A RESTful resource controller sets up some default routes for you and even names them.

Route::resource('users', 'UsersController');

Gives you these named routes:

Verb          Path                        Action  Route Name
GET           /users                      index   users.index
GET           /users/create               create  users.create
POST          /users                      store   users.store
GET           /users/{user}               show    users.show
GET           /users/{user}/edit          edit    users.edit
PUT|PATCH     /users/{user}               update  users.update
DELETE        /users/{user}               destroy users.destroy

And you would set up your controller something like this (actions = methods)

class UsersController extends BaseController {

    public function index() {}

    public function show($id) {}

    public function store() {}

}

https://stackoverflow.com/questions/23505875/laravel-routeresource-vs-routecontroller

Laravel File Downloaded from storage folder gets corrupted

I believe that the Laravel framework might be introducing whitespace which might be ruining the header() function.

Use ob_end_clean() before your first header() call to remove any extra whitespace.

ob_end_clean();
$headers = array(
‘Content-Type: image/png’,
);
return response()->download(storage_path() . ‘/’.$filename, ‘final.png’, $headers);

https://exceptionshub.com/laravel-file-downloaded-from-storage-folder-gets-corrupted.html