1

How to Create Model in Laravel 7 using Command?

 1 year ago
source link: https://www.laravelcode.com/post/how-to-create-model-in-laravel-7-using-command
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

How to Create Model in Laravel 7 using Command?

  59895 views

  2 years ago

Laravel

In this tutorial,i will learn you give to engender a model utilizing a command in laravel 7. you can define the make:model command in your terminal.  you can simply use a command to engender model in laravel 7

Example 1
php artisan make:model Admin
  • This command is used to create a model in laravel project.
  • This command is only created to model in project.
  • It will create to file in project.

1.Model

app/Admin.php

Example 2
php artisan make:model Admin --migration
php artisan make:model Admin -m
  • This command is use to create model with migration in laravel project.
  • It will create to files in project.

1.Model

app/Admin.php

2.Migration

migrations/2019_11_25_120400_create_admins_table.php

Example 3
php artisan make:model Admin --controller
php artisan make:model Admin -c
  • This command is used to create model with controller in your laravel project.
  • It will create to files in project.

1.Model

app/Admin.php

2.Controller

app/Http/Controllers/AdminController.php

Example 4
php artisan make:model Admin --resource
php artisan make:model Admin -r
  • This command is used to create model,controller or crud method in your laravel project.
  • It will create to files in project.

1.Model

app/Admin.php

2.Controller

app/Http/Controllers/AdminController.php

3.crud Method

also create this function in controller : index(),create(),store(),show(),update()

Example 5
php artisan make:model Admin --migration --controller --resource
php artisan make:model Admin --all
php artisan make:model Admin -a
  • This command is used to create model,migration or controller with crud method in laravel project.
  • It will create to files in project.

1.Model

app/Admin.php

2.Migration

migrations/2019_11_25_120400_create_admins_table.php

3.Controller

app/Http/Controllers/AdminController.php

4.crud Method

also create this function in controller : index(),create(),store(),show(),update()

i hope it will help you lot..


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK