You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I am trying to use the cron. I am using Laravel 5.3. I have installed the vendor as per the documentation. But I am not using mysql database. So, I had not run 'php artisan migrate --path=vendor/liebig/cron/src/migrations' comment. But when I run 'php artisan cron:run' comment I have this error. 'PHP Fatal error: Class 'App\Providers\Cron' not found in C:\xampp\htdocs\isend\blog\app\Providers\AppServiceProvider.php on line 17'.
I have attached one image. One is the error. I have also attached the 'AppServiceProvider' code. Please help me.
`<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void /
public function boot()
{
// Sendmail Cron
Cron::add('sendmail', '/1 * * * ', function() {
shell_exec('php -q /opt/lampp/htdocs/isend/blog/cron/sendMail.php > /dev/null 2>&1 &');
return null;
});
// Test Cron
Cron::add('test_cron', '/1 * * * *', function() {
$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");
$txt = "John Doe\n";
fwrite($myfile, $txt);
fclose($myfile);
return null;
});
Cron::setDatabaseLogging(false);
$report = Cron::run();
print_r ($report);
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
}
`
The text was updated successfully, but these errors were encountered:
You can configure crontab on your server to call the artisan cron:run command or you need an online cronjob web service, which call the url. Google is your friend for this cronjob web service.
Hi,
I am trying to use the cron. I am using Laravel 5.3. I have installed the vendor as per the documentation. But I am not using mysql database. So, I had not run 'php artisan migrate --path=vendor/liebig/cron/src/migrations' comment. But when I run 'php artisan cron:run' comment I have this error. 'PHP Fatal error: Class 'App\Providers\Cron' not found in C:\xampp\htdocs\isend\blog\app\Providers\AppServiceProvider.php on line 17'.
I have attached one image. One is the error. I have also attached the 'AppServiceProvider' code. Please help me.
`<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
/
public function boot()
{
// Sendmail Cron
Cron::add('sendmail', '/1 * * * ', function() {
shell_exec('php -q /opt/lampp/htdocs/isend/blog/cron/sendMail.php > /dev/null 2>&1 &');
return null;
});
// Test Cron
Cron::add('test_cron', '/1 * * * *', function() {
$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");
$txt = "John Doe\n";
fwrite($myfile, $txt);
fclose($myfile);
return null;
});
}
`
The text was updated successfully, but these errors were encountered: