3

In my Laravel project, I use nwidart package for making modules. Now I want to add deleted_at column to an existing model. I should make a new migration in my module. How can I do this?

Here is the package documentation: https://nwidart.com/laravel-modules/v4/advanced-tools/artisan-commands

I want some thing like this for module:

php artisan make:migration add_soft_deletes_to_user_table --table="users"

Majid Alaeinia
  • 962
  • 2
  • 11
  • 27
Haniye Shadman
  • 357
  • 1
  • 6
  • 19

1 Answers1

7

Try this command:

php artisan module:make-migration add_soft_deletes_to_users_table <ModuleName>

Then do not forget to use Illuminate\Database\Eloquent\SoftDeletes trait on your User model.

use Illuminate\Database\Eloquent\SoftDeletes;

class User extends Model {

use SoftDeletes;

}
Majid Alaeinia
  • 962
  • 2
  • 11
  • 27