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’ => [
// \Illuminate\Session\Middleware\AuthenticateSession::class,

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
GET           /users/{user}               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() {}


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.

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