Files
jandl-taskmanager-app/be/app/Console/Commands/SyncVacationsFromIntranet.php
T

46 lines
944 B
PHP

<?php
namespace App\Console\Commands;
use App\Mail\Error;
use App\Services\Intranet\IntranetService;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Mail;
class SyncVacationsFromIntranet extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'intranet:sync-vacations';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Syncs vacations from Intranet to our DB';
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$intranetService = new IntranetService();
try {
$intranetService->syncVacations();
} catch (\Exception $e) {
Mail::to('feher@studiotem.com')->send(new Error($e));
return Command::FAILURE;
}
return Command::SUCCESS;
}
}