laravel admin基础使用教程
发布时间:2020-10-27 10:58:05 浏览:1151

1、创建模型

php artisan make:model Model\Paypal

php artisan make:model Model\Paypal -mf 同时创建数据库迁移文件

修改 /migrations/< your_date >_create_products_table.php

创建一个paypal的模型

2、生成表

执行命令:

php artisan migrate

php artisan make:seeder StatusesTableSeeder  创建一个seeder 填充数据

public function run()

{

factory(News::class)->times(50)->create();

}

 

DatabaseSeeder.php 里的run方法里去新增call

public function run()

{

$this->call(NewsTableSeeder::class);

$this->call(WeixinTableSeeder::class);

}

执行

php artisan migrate:refresh --seed

3、生成数据

新建控制器

php artisan admin:make PaypalController --model=App\\Model\\Paypal

php artisan migrate:refresh 重置

4、增加数据

在tinker下创建

factory(App\User::class,20)->create()