PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, August 24, 2022

[FIXED] How to make a migration in laravel module?

 August 24, 2022     eloquent, laravel, laravel-migrations, module     No comments   

Issue

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"


Solution

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;

}


Answered By - Majid Alaeinia
Answer Checked By - Mary Flores (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing