Skip to content

Commit

Permalink
Fix #2
Browse files Browse the repository at this point in the history
  • Loading branch information
leonjza committed Dec 4, 2015
1 parent 782f543 commit 496a73f
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

namespace App\Console;

use DB;
use Exception;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Schema;
use Seat\Services\Models\Schedule as DBSchedule;

/**
Expand Down Expand Up @@ -32,6 +35,23 @@ class Kernel extends ConsoleKernel
protected function schedule(Schedule $schedule)
{

// Check that the schedules table exists. This
// could cause a fatal error if the app is
// still being setup or the db has not yet
// been configured. This is a relatively ugly
// hack as this schedule() method is core to
// the framework.
try {

DB::connection();
if (!Schema::hasTable('schedules'))
throw new Exception('Schema schedules does not exist');

} catch (Exception $e) {

return;
}

// Load the schedule from the database
foreach (DBSchedule::all() as $job) {

Expand Down

0 comments on commit 496a73f

Please sign in to comment.