Commit a7e6a89c authored by Taylor Otwell's avatar Taylor Otwell

Add scheduled commands.

parent e3e7cc49
<?php namespace App\Console; <?php namespace App\Console;
use Exception; use Exception;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel; use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel { class Kernel extends ConsoleKernel {
...@@ -15,26 +16,15 @@ class Kernel extends ConsoleKernel { ...@@ -15,26 +16,15 @@ class Kernel extends ConsoleKernel {
]; ];
/** /**
* Run the console application. * Define the application's command schedule.
* *
* @param \Symfony\Component\Console\Input\InputInterface $input * @param \Illuminate\Console\Scheduling\Schedule $schedule
* @param \Symfony\Component\Console\Output\OutputInterface $output * @return void
* @return int
*/ */
public function handle($input, $output = null) protected function schedule(Schedule $schedule)
{ {
try $schedule->artisan('foo')
{ ->hourly();
return parent::handle($input, $output);
}
catch (Exception $e)
{
$this->reportException($e);
$this->renderException($output, $e);
return 1;
}
} }
} }
<?php namespace App\Exceptions;
use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler {
/**
* Report or log an exception.
*
* @param \Exception $e
* @return void
*/
public function report(Exception $e)
{
return parent::report($e);
}
/**
* Render an exception into a response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $e
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $e)
{
return parent::render($request, $e);
}
}
...@@ -19,24 +19,4 @@ class Kernel extends HttpKernel { ...@@ -19,24 +19,4 @@ class Kernel extends HttpKernel {
'Illuminate\Foundation\Http\Middleware\VerifyCsrfToken', 'Illuminate\Foundation\Http\Middleware\VerifyCsrfToken',
]; ];
/**
* Handle an incoming HTTP request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function handle($request)
{
try
{
return parent::handle($request);
}
catch (Exception $e)
{
$this->reportException($e);
return $this->renderException($request, $e);
}
}
} }
...@@ -38,7 +38,7 @@ $app->singleton( ...@@ -38,7 +38,7 @@ $app->singleton(
$app->singleton( $app->singleton(
'Illuminate\Contracts\Debug\ExceptionHandler', 'Illuminate\Contracts\Debug\ExceptionHandler',
'Illuminate\Foundation\Debug\ExceptionHandler' 'App\Exceptions\ExceptionHandler'
); );
/* /*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment