简体   繁体   中英

Laravel Voyager installation issue

I just finished my first laravel project> Now I only need to install an admin panel. I tried to install Laravel Voyager but I got an issue because I had a role table already created, So it stopped the installation. Is there a way to fix this issue or should I use admin panel, what do you advice me? I already had a role table with helpers methods and data that I am currently using. I completely unistall it and I delete all files that I got during the installation.

In the past, I run into the same issue with Voyager, with my previous users and a roles table. Since I had logic already in place for the user's/role table design, what I did was fuse both tables migrations into one. In detail these are the steps I went through to accomplish that:

  1. Create new database for Voyager's installation.
  2. Update .env to access new DB (would be advisable to clear cache after).
  3. Install Voyager php artisan voyager:install (after Voyager vendor was installed using composer).
  4. Copy Voyagers migrations to database/migrations , make your changes, turn off the config option database.autoload_migrations (full guidance for this step can be found in https://voyager-docs.devdojo.com/getting-started/installation#advanced ).
  5. Merge conflicting migrations files (in this case the roles table, or any other that can conflict with Voyager's migrations), meaning bringing columns needed from the previous migration into Voyager's migration file.
  6. Delete all tables from the database again (since migrations tables were modified) and run php artisan migrate .

Now you should end-up having the previous roles table (with previous and new Voyagers columns, and definitions), without affecting the Voyager's tables functionality:)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM