1
0
mirror of https://github.com/devfake/flox.git synced 2024-11-15 22:52:32 +01:00
flox/backend/app/Console/Commands/Sync.php

34 lines
911 B
PHP
Raw Normal View History

2016-10-10 10:57:39 +02:00
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class Sync extends Command {
protected $signature = 'flox:sync';
protected $description = 'Synchronize your movies with your scout search driver';
public function __construct()
{
parent::__construct();
}
public function handle()
{
$scoutDriver = env('SCOUT_DRIVER');
try {
$this->info('TRYING TO SYNC YOUR MOVIES TO ' . strtoupper($scoutDriver));
2016-10-19 11:19:34 +02:00
$this->call('scout:flush', ['model' => 'App\\Item']);
2016-10-10 10:57:39 +02:00
$this->call('scout:import', ['model' => 'App\\Item']);
$this->info('SYNCHRONIZATION COMPLETED');
} catch(\Exception $e) {
$this->error('Can not connect to ' . $scoutDriver . '. Error: ' . $e->getMessage());
$this->error('Make sure your ' . $scoutDriver . ' credentials in .env are correct');
return;
}
}
}