Good afternoon.

Actually, while I roughly plan(experiment) with a database, I do not want to record all changes through separate small migrations.
Often I recreate the database($php artisan migrate: fresh --seed), losing OAuth data.Then you have to reinstall the passport and register the token in the .env file.
How to avoid it? Clean up the migration table with * oauth * records in the database?

Thank.

3 Answers 3

Yes, as answered above, you need to use sids
I for example did a sid that simply updated the secret for the application:
\ Illuminate \ Support \ Facades \ DB :: table('oauth_clients') ->where('id', 2) ->update(['secret'=>'vy9FVaqCx6mwW1vjApsDBjwju7ufIFDkHG866Ufb']);

after running migrations, installing a passport(passposrt: install), sids
And for example in postman there is nothing to update for testing, tokens are always the same
  • Thank you, this is what you need!

    Created OauthSeeder.php.
    Registered a secret update.
    Added it to DatabaseSeeder.php

    Wrote a small alias in .bashhrc
    alias artmf='php artisan migrate: fresh;php artisan passport: install;php artisan db: seed'

    ps: Insomnia more postman came to me;)
    – Fantastic Finch Jul 16 '19 at 17:02
For stuffing the database with all sorts of sample/test data there is a seed, but you can also fill in the migration.
In sidah, to generate everything you need, including a passport.In migrations, it is better not to do it, because they are also launched in production, where it is better to do everything with pens.