laravelcontrollerlaravel-7

Difference between a 'Controller' and a 'Resource Controller' in Laravel


In Laravel, what's the difference between a regular controller and resource controller? Please provide examples to illustrate the differences.


Solution

  • There is mainly no difference..It a special type of controller. When you create a controller like this

    php artisan make:controller YourNameController --resource
    
    

    it auto create some function like index, create, store, show, edit, update, destroy. basically for crud. For details go to documentation https://laravel.com/docs/7.x/controllers#resource-controllers