当前位置:网站首页>Laravel generate entity

Laravel generate entity

2022-07-05 13:43:00 Php_ XiaoZhi

One 、 Generate by command User Model class

php artisan make:model Http/Models/User

If the table name is user, You need to set the mandatory table name to user, Otherwise, it will access by default users surface

protected $table = 'user';?

Two 、 Install the model class code prompt plug-in

Install the model class code prompt plug-in plug-in

composer require barryvdh/laravel-ide-helper

Generate comments for the data model

php artisan ide-helper:models         Generate all

php artisan ide-helper:models "App\Models\User"     Generate single


by Facades Generate annotations

php artisan ide-helper:generate

3、 ... and 、 test

User::where()->get();

It's normal .
 

原网站

版权声明
本文为[Php_ XiaoZhi]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202140520464184.html