如何在 laravel 模块中进行迁移?
How to make a migration in laravel module?
在我的Laravel项目中,我使用nwidart包来制作模块。现在我想将 deleted_at
列添加到现有模型。我应该在我的模块中进行新的迁移。
我该怎么做?
这是包文档:
https://nwidart.com/laravel-modules/v4/advanced-tools/artisan-commands
我想要这样的模块:
php artisan make:migration add_soft_deletes_to_user_table --table="users"
试试这个命令:php artisan module:make-migration add_soft_deletes_to_users_table <ModuleName>
.
然后不要忘记在您的 User
模型上使用 Illuminate\Database\Eloquent\SoftDeletes
特征。
use Illuminate\Database\Eloquent\SoftDeletes;
class User extends Model {
use SoftDeletes;
}
在我的Laravel项目中,我使用nwidart包来制作模块。现在我想将 deleted_at
列添加到现有模型。我应该在我的模块中进行新的迁移。
我该怎么做?
这是包文档: https://nwidart.com/laravel-modules/v4/advanced-tools/artisan-commands
我想要这样的模块:
php artisan make:migration add_soft_deletes_to_user_table --table="users"
试试这个命令:php artisan module:make-migration add_soft_deletes_to_users_table <ModuleName>
.
然后不要忘记在您的 User
模型上使用 Illuminate\Database\Eloquent\SoftDeletes
特征。
use Illuminate\Database\Eloquent\SoftDeletes;
class User extends Model {
use SoftDeletes;
}