laravel-artisan

Setting up a Laravel cron job in cPanel

旧城冷巷雨未停 提交于 2021-01-03 01:31:13
问题 I have the following function: protected function schedule(Schedule $schedule) { $schedule->command('email:users')->everyMinute(); } when I run the command artisan schedule:run it sends an email but when I add the following command to the cpanel as a cron job it doesn't send any email. Cpanel suppose to email me a notification when the cron job is run but I haven't receive a single email. php /home/rain/artisan schedule:run 1>> /dev/null 2>&1 Where am I doing wrong? Also when I run the

Laravel Artisan: How does `schedule:run` work?

两盒软妹~` 提交于 2021-01-02 05:30:29
问题 I have a dummy Command job set up, whose handle() function is as follows: public function handle() { $this->line('=================='); $this->line('Running my job at ' . Carbon::now()); $this->line('Ending my job at ' . Carbon::now()); } As you see, it doesn't actually do anything but return a few lines of info to the standard output. Now, in my App\Console\Kernel class, I have set up the following schedule: protected function schedule(Schedule $schedule) { $schedule -> command('cbh

Running artisan command from controller or route

帅比萌擦擦* 提交于 2020-12-31 05:59:33
问题 I use Spatie Laravel package I can take backup by running this command php artisan backup:run but I want to take back up form admin panel and running this command form controller, I create a route and controller and in the controller, I do this public function backup(){ \Artisan::call('backup:run'); return "successfully!"; } when I route to this finally I got the success message but in the backup file, nothing added. 回答1: You can put artisan command in sheduler. It will make back up for

Laravel 5.8 custom command not found

别说谁变了你拦得住时间么 提交于 2020-12-15 11:47:23
问题 I have created a custom command using artisan: php artisan make:command resetNegotiations Than deleted cache with: php artisan cache:clear But if I try to run: php artisan ResetNegotiations I got the error: Command "ResetNegotiations" is not defined. The file ResetNegotiations.php exists in app/Console/Commands I have found similar questions: - Command is not defined exception but it not fixed mine. I have updated the kernel as https://laravel.com/docs/5.8/artisan#registering-commands in app

Laravel 5.8 custom command not found

旧街凉风 提交于 2020-12-15 11:45:28
问题 I have created a custom command using artisan: php artisan make:command resetNegotiations Than deleted cache with: php artisan cache:clear But if I try to run: php artisan ResetNegotiations I got the error: Command "ResetNegotiations" is not defined. The file ResetNegotiations.php exists in app/Console/Commands I have found similar questions: - Command is not defined exception but it not fixed mine. I have updated the kernel as https://laravel.com/docs/5.8/artisan#registering-commands in app

How do I create Events/Listeners with artisan command at sub-directory level?

时光总嘲笑我的痴心妄想 提交于 2020-12-15 09:17:11
问题 So, I am fairly new to Laravel and working on huge laravel project. I need a way by which I can create Events and Listeners folders in my subdirectory with php artisan event:generate command or php artisan make:event and php artisan make:listener commands. I have tried running these commands but it creates Events and Listeners in root directory under app/Events and app/Listeners. We have a different directory structure where apart from the app we have src/directory1/directroy2/directroy3 .

How do I create Events/Listeners with artisan command at sub-directory level?

点点圈 提交于 2020-12-15 09:15:11
问题 So, I am fairly new to Laravel and working on huge laravel project. I need a way by which I can create Events and Listeners folders in my subdirectory with php artisan event:generate command or php artisan make:event and php artisan make:listener commands. I have tried running these commands but it creates Events and Listeners in root directory under app/Events and app/Listeners. We have a different directory structure where apart from the app we have src/directory1/directroy2/directroy3 .

Laravel task scheduler permission problem with cleanDirectory command

ⅰ亾dé卋堺 提交于 2020-12-15 04:28:29
问题 I've set up a console command with a handle() function like this: public function handle() { $fileSystem = new Filesystem; $fileSystem->cleanDirectory('storage/app/public/tmp'); } And in the console kernel I set up the command: $schedule->command('cleanupfiles:tmp') ->everyMinute() ->sendOutputTo(storage_path('logs/taskoutput.log')); The superuser's crontab has the following entry: * * * * * php /var/www/website/artisan schedule:run >> /dev/null 2>&1 I can see the task scheduler getting

Laravel 5.1 Php artisan commands not working after composer update

跟風遠走 提交于 2020-12-13 18:46:47
问题 here is my composer.json require snippet. "require": { "php": ">=5.5.9", "laravel/framework": "5.1.35", "aws/aws-sdk-php-laravel": "~3.0", "lucadegasperi/oauth2-server-laravel": "5.1.*", "bosnadev/repositories": " 0.*", "laravelcollective/html": "5.1.*", "cartalyst/stripe-laravel": "3.0.*" }, I ran composer update in order to add new AWS services. but then I noted that all the vendor files are updated because of composer update command. now I'm getting error when I ran php artisan commands.

Laravel 5.1 Php artisan commands not working after composer update

白昼怎懂夜的黑 提交于 2020-12-13 18:44:11
问题 here is my composer.json require snippet. "require": { "php": ">=5.5.9", "laravel/framework": "5.1.35", "aws/aws-sdk-php-laravel": "~3.0", "lucadegasperi/oauth2-server-laravel": "5.1.*", "bosnadev/repositories": " 0.*", "laravelcollective/html": "5.1.*", "cartalyst/stripe-laravel": "3.0.*" }, I ran composer update in order to add new AWS services. but then I noted that all the vendor files are updated because of composer update command. now I'm getting error when I ran php artisan commands.