Laravel PHP artisan makes a model with migration, controller and resources

1. Create a model command: This command creates the Product model placed in the app/models directory.

php artisan make:model Product

2. Create Controller Command: You can use the php artisan make: controller command to create a controller. This command will create a controller named ProductController, Which is placed in app/http/controllers directory.

php artisan make:controller ProductController

3. Create a Resource Controller Command: PHP artisan make controller resource command creates a resource controller. It has already created some methods like index, update, edit, destroy, etc.

php artisan make:controller ProductController –resource

4. Create Model, Controller, Migration, and resources. This single command has been created as a Product controller and model.

php artisan make:model Product -mcr

5. Create model, migration, and controller If you want to create a controller and model, you can execute the following comments for creating a controller and model in the command prompt:

php artisan make:model -mc

6. Create Model and Migration: Execute the following command on the command prompt to create a model and migration file:

php artisan make:model Product -m

7. Create API Controller using Artisan: Use the following command to create api controller. This command will create api product controller, which is placed on app/http/controllers/API directory.

php artisan make:controller API\ProductController

8. Create a model and controller: This single command has been created as a product controller and model.

php artisan make:model Product -c

9. Create Model controller and resources

php artisan make:model Product -cr

2 thoughts on “Laravel PHP artisan makes a model with migration, controller and resources”

  1. You are in point of fact a just right webmaster. This website loading speed
    is amazing. It kind of feels that you are doing any unique trick.
    In addition, the contents are masterpiece. you have done a great
    job in this matter

    Reply

Leave a Comment