Closed hfzm closed 4 days ago
This is by design and is not a bug.
Consider: the database is created from scratch on each new installation of your application.
You should build your application in a way that it attempts to seed the database on first run if it's not already seeded.
Yeah, so how can I do it? As you're saying I should build it in a way that it should seed on each fresh installation, and as the installation process is related to Electron and NativePHP configuration so I could not find anything in the documentation to run my seeder files on fresh install. Your help would be really appreciated in this if you can add some guidance to the documentation it would be really helpful. Thanks in advance. It is really a great technology and because of this, I am just one step away from creating my project and presenting it to the public.
On Fri, Oct 18, 2024 at 10:42 PM Simon Hamp @.***> wrote:
Closed #384 https://github.com/NativePHP/laravel/issues/384 as completed.
— Reply to this email directly, view it on GitHub https://github.com/NativePHP/laravel/issues/384#event-14725279168, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOZN4XNW5ZYA5RGE2E2OFHLZ4FFSNAVCNFSM6AAAAABP2ECSSCVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJUG4ZDKMRXHEYTMOA . You are receiving this because you authored the thread.Message ID: @.***>
You can call the db:seed
Artisan command from PHP using the Artisan
facade.
Wrap that call in an if
which checks your DB first to see if it has been seeded. (You might want an explicit record in one of your seeders that gives you a clear signal that seeding has happened)
Put that whole block somewhere that will run every time your app boots - e.g. the NativeServiceProvider - so that it runs every time.
Thank you very much for your support, I really appreciate it. NativePHP is a great project and I wish more success for it in the future and I hope it will conquer the world of mobile applications too. Thanks again for your email. I think it will do the job done and finally I can publish my desktop application successfully.
On Sat, Oct 19, 2024 at 2:53 PM Simon Hamp @.***> wrote:
You can call the db:seed Artisan command from PHP using the Artisan facade.
Wrap that call in an if which checks your DB first to see if it has been seeded. (You might want an explicit record in one of your seeders that gives you a clear signal that seeding has happened)
Put that whole block somewhere that will run every time your app boots - e.g. the NativeServiceProvider - so that it runs every time.
— Reply to this email directly, view it on GitHub https://github.com/NativePHP/laravel/issues/384#issuecomment-2423744788, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOZN4XKY7URY42CXCZZVIY3Z4IXILAVCNFSM6AAAAABP2ECSSCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMRTG42DINZYHA . You are receiving this because you authored the thread.Message ID: @.***>
What were you trying to do?
Thank you for this great technology. I was trying to build my application with sqlite3 database and I was trying to seed some data in development mode.
What happened?
It shows the data without any errors in my application in development phase but when I build and package my application the seeded data is not included in the built mode.
How to reproduce the bug
Please solve this issue because we need some seeded data always either its development or production mode for example roles and permissions table data. Thanks in advance. Keep up the great work.
Package Versions
I am using the latest verson always.
PHP Version
8.1
Laravel Version
11
Node Version
18
Which operating systems have you seen this occur on?
Linux
OS version
Ubuntu 24 LTS
Notes
No response