I had set up an artisan command like php artisan db:update 2014-08-01 2014-12-16
but it would cause memory exhausted and cause a php fatal error.
so I need to manually execute
php artisan db:update 2014-08-01 2014-08-01
php artisan db:update 2014-08-02 2014-08-02....
Is there any simple method that could execute loop between two dates?
Thanks
You'll need a cron job to do the updating, at specified intervals.
The one package, i recommend for this purpose is: https://github.com/Indatus/dispatcher
You can execute it through artisan or schedule the job directly from your php class.
Related
after rollback php artisan migrate:rollback --step 2 then I need to run command php artisan migrate . is there are any single command line for rollback and migrate ? like php artisan migrate:fresh
You can run below command
php artisan migrate:rollback --step=2
Also you can refer this documentation https://laravel.com/docs/master/migrations#running-migrations
You may roll back & re-migrate a limited number of migrations by providing the step option to the refresh command. For example, the following command will roll back & re-migrate the last five migrations:
php artisan migrate:refresh --step=2
I need to run Laravel 6 application
and after running migrations I see that many tables are empty, including users.
In modules subdirectory I found files
/Modules/Users/Database/migrations/create_users_table.php
/Modules/Users/Database/seeders/UsersSeeder.php
Last file has default users
It was strange that running command
php artisan module:list
I see list of modules, but not Users module, as I expected
So I got error running in the root of my app:
php artisan module:seed Users
RuntimeException : Module [Users] does not exists.
I tried to run only this seeder, but again with error :
$ php artisan db:seed --class=/Modules/Users/Database/seeders/UsersSeeder
Illuminate\Contracts\Container\BindingResolutionException : Target class [/Modules/Users/Database/seeders/UsersSeeder] does not exist.
How can I run seeder under Users module(which I do not see in output of php artisan module:list)
?
Thanks!
If you use artisan command to make seeder
php artisan make:seeder UsersSeeder
You get the file in
database/seeds/UsersSeeder
Then you can call
php artisan db:seed --class=UsersSeeder
Instead of
php artisan db:seed --class=/Modules/Users/Database/seeders/UsersSeeder
Do not forget to run
composer dump-autoload
after first command
Laravel is not being attempted (attempts = 0). I have created jobs table and dispatched a job.
The job is now currently being listed in the jobs table but with attempts = 0
I have updated QUEUE_CONNECTION=database and run php artisan config:cache. I have also hit queue:restart but still same result.
Additionally, I have tried with php artisan queue:work --force (without force as well) and php artisan queue:listen as well but still not being attempted.
You have dispatched the job to the property queue. To process this queue run:
php artisan queue:work --queue=property
I use the queue in my Laravel 5.4 project to send emails in background.
I have created the table for jobs, created the class for the job, and put QUEUE_DRIVER=database in my .env file. When I dispatch my Job, I can see my task in the jobs table. So far so good.
However, when I then execute the command
php artisan queue:work on the webserver - it's freezing and not have any results.
What could be the problem?
This probably is because this is a service that uses the current thread in Ubuntu (from your tag). If you add a &, the process will run in a forked thread.
php artisan queue:work &
Or after a quick google, you can have a look at
nohup php artisan queue:work --daemon &
Can someone know how can I run in one command to Laravel artisan work on all queue in project?
I know that I can run something like that nohup php artisan queue:work --queue=admin_contact_message_mail,user_get_message_notification,user_get_message_mail --daemon & , but I have a huge list of queues and asks is there any way to call it all in once or I need to list them all to queue run it and listen it?
php artisan queue:listen will do the job!