This commit is contained in:
Graham Campbell
2014-12-20 21:20:17 +00:00
parent 26e4361d8a
commit 9d8d89248f
103 changed files with 2478 additions and 2353 deletions
@@ -2,18 +2,20 @@
namespace CachetHQ\Cachet\Controllers\Api; namespace CachetHQ\Cachet\Controllers\Api;
use Input; use CachetHQ\Cachet\Repositories\Component\ComponentRepository;
use Dingo\Api\Routing\ControllerTrait; use Dingo\Api\Routing\ControllerTrait;
use Illuminate\Routing\Controller; use Illuminate\Routing\Controller;
use CachetHQ\Cachet\Repositories\Component\ComponentRepository; use Input;
class ComponentController extends Controller { class ComponentController extends Controller
{
use ControllerTrait; use ControllerTrait;
protected $component; protected $component;
public function __construct(ComponentRepository $component) { public function __construct(ComponentRepository $component)
{
$this->component = $component; $this->component = $component;
} }
@@ -22,7 +24,8 @@ class ComponentController extends Controller {
* *
* @return \Illuminate\Database\Eloquent\Collection * @return \Illuminate\Database\Eloquent\Collection
*/ */
public function getComponents() { public function getComponents()
{
return $this->component->all(); return $this->component->all();
} }
@@ -33,7 +36,8 @@ class ComponentController extends Controller {
* *
* @return \Component * @return \Component
*/ */
public function getComponent($id) { public function getComponent($id)
{
return $this->component->findOrFail($id); return $this->component->findOrFail($id);
} }
@@ -42,7 +46,8 @@ class ComponentController extends Controller {
* @param int $id Component ID * @param int $id Component ID
* @return \Component * @return \Component
*/ */
public function getComponentIncidents($id) { public function getComponentIncidents($id)
{
return $this->component->with($id, ['incidents']); return $this->component->with($id, ['incidents']);
} }
@@ -51,7 +56,8 @@ class ComponentController extends Controller {
* *
* @return \Component * @return \Component
*/ */
public function postComponents() { public function postComponents()
{
return $this->component->create($this->auth->user()->id, Input::all()); return $this->component->create($this->auth->user()->id, Input::all());
} }
} }
@@ -2,18 +2,20 @@
namespace CachetHQ\Cachet\Controllers\Api; namespace CachetHQ\Cachet\Controllers\Api;
use Input; use CachetHQ\Cachet\Repositories\Incident\IncidentRepository;
use Dingo\Api\Routing\ControllerTrait; use Dingo\Api\Routing\ControllerTrait;
use Illuminate\Routing\Controller; use Illuminate\Routing\Controller;
use CachetHQ\Cachet\Repositories\Incident\IncidentRepository; use Input;
class IncidentController extends Controller { class IncidentController extends Controller
{
use ControllerTrait; use ControllerTrait;
protected $incident; protected $incident;
public function __construct(IncidentRepository $incident) { public function __construct(IncidentRepository $incident)
{
$this->incident = $incident; $this->incident = $incident;
} }
@@ -22,7 +24,8 @@ class IncidentController extends Controller {
* *
* @return \Illuminate\Database\Eloquent\Collection * @return \Illuminate\Database\Eloquent\Collection
*/ */
public function getIncidents() { public function getIncidents()
{
return $this->incident->all(); return $this->incident->all();
} }
@@ -33,7 +36,8 @@ class IncidentController extends Controller {
* *
* @return Incident * @return Incident
*/ */
public function getIncident($id) { public function getIncident($id)
{
return $this->incident->findOrFail($id); return $this->incident->findOrFail($id);
} }
@@ -42,7 +46,8 @@ class IncidentController extends Controller {
* *
* @return Incident * @return Incident
*/ */
public function postIncidents() { public function postIncidents()
{
return $this->incident->create($this->auth->user()->id, Input::all()); return $this->incident->create($this->auth->user()->id, Input::all());
} }
@@ -53,7 +58,8 @@ class IncidentController extends Controller {
* *
* @return Incident * @return Incident
*/ */
public function putIncident($id) { public function putIncident($id)
{
return $this->incident->update($id, Input::all()); return $this->incident->update($id, Input::all());
} }
} }
@@ -2,18 +2,20 @@
namespace CachetHQ\Cachet\Controllers\Api; namespace CachetHQ\Cachet\Controllers\Api;
use Input; use CachetHQ\Cachet\Repositories\Metric\MetricRepository;
use Dingo\Api\Routing\ControllerTrait; use Dingo\Api\Routing\ControllerTrait;
use Illuminate\Routing\Controller; use Illuminate\Routing\Controller;
use CachetHQ\Cachet\Repositories\Metric\MetricRepository; use Input;
class MetricController extends Controller { class MetricController extends Controller
{
use ControllerTrait; use ControllerTrait;
protected $metric; protected $metric;
public function __construct(MetricRepository $metric) { public function __construct(MetricRepository $metric)
{
$this->metric = $metric; $this->metric = $metric;
} }
/** /**
@@ -21,7 +23,8 @@ class MetricController extends Controller {
* *
* @return \Illuminate\Database\Eloquent\Collection * @return \Illuminate\Database\Eloquent\Collection
*/ */
public function getMetrics() { public function getMetrics()
{
return $this->metric->all(); return $this->metric->all();
} }
@@ -32,7 +35,8 @@ class MetricController extends Controller {
* *
* @return Metric * @return Metric
*/ */
public function getMetric($id) { public function getMetric($id)
{
return $this->metric->findOrFail($id); return $this->metric->findOrFail($id);
} }
@@ -41,7 +45,8 @@ class MetricController extends Controller {
* *
* @return Metric * @return Metric
*/ */
public function postMetrics() { public function postMetrics()
{
return $this->metric->create(Input::all()); return $this->metric->create(Input::all());
} }
@@ -52,7 +57,8 @@ class MetricController extends Controller {
* *
* @return Metric * @return Metric
*/ */
public function putMetric($id) { public function putMetric($id)
{
return $this->metric->update($id, Input::all()); return $this->metric->update($id, Input::all());
} }
} }
@@ -2,18 +2,20 @@
namespace CachetHQ\Cachet\Controllers\Api; namespace CachetHQ\Cachet\Controllers\Api;
use Input; use CachetHQ\Cachet\Repositories\MetricPoint\MetricPointRepository;
use Dingo\Api\Routing\ControllerTrait; use Dingo\Api\Routing\ControllerTrait;
use Illuminate\Routing\Controller; use Illuminate\Routing\Controller;
use CachetHQ\Cachet\Repositories\MetricPoint\MetricPointRepository; use Input;
class MetricController extends Controller { class MetricPointController extends Controller
{
use ControllerTrait; use ControllerTrait;
protected $metricpoint; protected $metricpoint;
public function __construct(MetricPointRepository $metricpoint) { public function __construct(MetricPointRepository $metricpoint)
{
$this->metricpoint = $metricpoint; $this->metricpoint = $metricpoint;
} }
/** /**
@@ -21,7 +23,8 @@ class MetricController extends Controller {
* *
* @return \Illuminate\Database\Eloquent\Collection * @return \Illuminate\Database\Eloquent\Collection
*/ */
public function getMetricPoints() { public function getMetricPoints()
{
return $this->metricpoint->all(); return $this->metricpoint->all();
} }
@@ -32,7 +35,8 @@ class MetricController extends Controller {
* *
* @return MetricPoint * @return MetricPoint
*/ */
public function getMetricPoint($id) { public function getMetricPoint($id)
{
return $this->metricpoint->findOrFail($id); return $this->metricpoint->findOrFail($id);
} }
@@ -41,7 +45,8 @@ class MetricController extends Controller {
* *
* @return MetricPoint * @return MetricPoint
*/ */
public function postMetricPoints() { public function postMetricPoints()
{
return $this->metricpoint->create(Input::all()); return $this->metricpoint->create(Input::all());
} }
} }
@@ -2,7 +2,8 @@
namespace CachetHQ\Cachet\Repositories\Component; namespace CachetHQ\Cachet\Repositories\Component;
interface ComponentRepository { interface ComponentRepository
{
public function all(); public function all();
@@ -4,23 +4,26 @@ namespace CachetHQ\Cachet\Repositories\Component;
use CachetHQ\Cachet\Repositories\EloquentRepository; use CachetHQ\Cachet\Repositories\EloquentRepository;
use Component; use Component;
use Exception;
class EloquentComponentRepository extends EloquentRepository implements ComponentRepository { class EloquentComponentRepository extends EloquentRepository implements ComponentRepository
{
protected $model; protected $model;
public function __construct(Component $model) { public function __construct(Component $model)
{
$this->model = $model; $this->model = $model;
} }
public function create($user_id, array $array) { public function create($user_id, array $array)
{
$component = new $this->model($array); $component = new $this->model($array);
$component->user_id = $user_id; $component->user_id = $user_id;
$this->validate($component); $this->validate($component);
$component->saveOrFail(); $component->saveOrFail();
return $component; return $component;
} }
} }
@@ -2,16 +2,18 @@
namespace CachetHQ\Cachet\Repositories; namespace CachetHQ\Cachet\Repositories;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Exception; use Exception;
use Illuminate\Database\Eloquent\ModelNotFoundException;
abstract class EloquentRepository { abstract class EloquentRepository
{
/** /**
* Returns all models * Returns all models
* @return object * @return object
*/ */
public function all() { public function all()
{
return $this->model->all(); return $this->model->all();
} }
@@ -21,7 +23,8 @@ abstract class EloquentRepository {
* @param array $with Array of model relationships * @param array $with Array of model relationships
* @return object|ModelNotFoundException * @return object|ModelNotFoundException
*/ */
public function with($id, array $with = []) { public function with($id, array $with = [])
{
return $this->model->with($with)->findOrFail($id); return $this->model->with($with)->findOrFail($id);
} }
@@ -31,8 +34,10 @@ abstract class EloquentRepository {
* @param string $column * @param string $column
* @return $this * @return $this
*/ */
public function withAuth($id, $column = 'user_id') { public function withAuth($id, $column = 'user_id')
{
$this->model = $this->model->where($column, $id); $this->model = $this->model->where($column, $id);
return $this; return $this;
} }
@@ -41,7 +46,8 @@ abstract class EloquentRepository {
* @param int $id * @param int $id
* @return object * @return object
*/ */
public function find(int $id) { public function find(int $id)
{
return $this->model->find($id); return $this->model->find($id);
} }
@@ -50,7 +56,8 @@ abstract class EloquentRepository {
* @param integer $id * @param integer $id
* @return object|ModelNotFoundException * @return object|ModelNotFoundException
*/ */
public function findOrFail($id) { public function findOrFail($id)
{
return $this->model->findOrFail($id); return $this->model->findOrFail($id);
} }
@@ -61,12 +68,13 @@ abstract class EloquentRepository {
* @param array $columns * @param array $columns
* @return object|ModelNotFoundException * @return object|ModelNotFoundException
*/ */
public function findByOrFail($key, $value, $columns = ['*']) { public function findByOrFail($key, $value, $columns = ['*'])
{
if (! is_null($item = $this->model->where($key, $value)->first($columns))) { if (! is_null($item = $this->model->where($key, $value)->first($columns))) {
return $item; return $item;
} }
throw new ModelNotFoundException; throw new ModelNotFoundException();
} }
/** /**
@@ -75,7 +83,8 @@ abstract class EloquentRepository {
* @param string $value * @param string $value
* @return integer * @return integer
*/ */
public function count($key = null, $value = null) { public function count($key = null, $value = null)
{
if (is_null($key) || is_null($value)) { if (is_null($key) || is_null($value)) {
return $this->model->where($key, $value)->count(); return $this->model->where($key, $value)->count();
} }
@@ -87,7 +96,8 @@ abstract class EloquentRepository {
* Deletes a model by ID * Deletes a model by ID
* @param inetegr $id * @param inetegr $id
*/ */
public function destroy($id) { public function destroy($id)
{
$this->model->delete($id); $this->model->delete($id);
} }
@@ -96,7 +106,8 @@ abstract class EloquentRepository {
* @param object $model * @param object $model
* @return Exception * @return Exception
*/ */
public function validate($model) { public function validate($model)
{
if ($model->isInvalid()) { if ($model->isInvalid()) {
throw new Exception('Invalid model validation'); throw new Exception('Invalid model validation');
} }
@@ -110,7 +121,8 @@ abstract class EloquentRepository {
* @param string $relationship Name of the relationship to validate against * @param string $relationship Name of the relationship to validate against
* @return Exception * @return Exception
*/ */
public function hasRelationship($model, $relationship) { public function hasRelationship($model, $relationship)
{
if (! $model->$relationship) { if (! $model->$relationship) {
throw new Exception('Invalid relationship exception'); throw new Exception('Invalid relationship exception');
} }
@@ -5,31 +5,37 @@ namespace CachetHQ\Cachet\Repositories\Incident;
use CachetHQ\Cachet\Repositories\EloquentRepository; use CachetHQ\Cachet\Repositories\EloquentRepository;
use Incident; use Incident;
class EloquentIncidentRepository extends EloquentRepository implements IncidentRepository { class EloquentIncidentRepository extends EloquentRepository implements IncidentRepository
{
protected $model; protected $model;
public function __construct(Incident $model) { public function __construct(Incident $model)
{
$this->model = $model; $this->model = $model;
} }
public function create($user_id, array $array) { public function create($user_id, array $array)
{
$incident = new $this->model($array); $incident = new $this->model($array);
$incident->user_id = $user_id; $incident->user_id = $user_id;
$this->validate($incident)->hasRelationship($incident, 'component'); $this->validate($incident)->hasRelationship($incident, 'component');
$incident->saveOrFail(); $incident->saveOrFail();
return $incident; return $incident;
} }
public function update($id, array $array) { public function update($id, array $array)
{
$incident = $this->model->findOrFail($id); $incident = $this->model->findOrFail($id);
$incident->fill($array); $incident->fill($array);
$this->validate($incident)->hasRelationship($incident, 'component'); $this->validate($incident)->hasRelationship($incident, 'component');
$incident->update($array); $incident->update($array);
return $incident; return $incident;
} }
} }
@@ -2,7 +2,8 @@
namespace CachetHQ\Cachet\Repositories\Incident; namespace CachetHQ\Cachet\Repositories\Incident;
interface IncidentRepository { interface IncidentRepository
{
public function all(); public function all();
@@ -5,30 +5,36 @@ namespace CachetHQ\Cachet\Repositories\Metric;
use CachetHQ\Cachet\Repositories\EloquentRepository; use CachetHQ\Cachet\Repositories\EloquentRepository;
use Metric; use Metric;
class EloquentMetricRepository extends EloquentRepository implements MetricRepository { class EloquentMetricRepository extends EloquentRepository implements MetricRepository
{
protected $model; protected $model;
public function __construct(Metric $model) { public function __construct(Metric $model)
{
$this->model = $model; $this->model = $model;
} }
public function create(array $array) { public function create(array $array)
{
$metric = new $this->model($array); $metric = new $this->model($array);
$this->validate($metric); $this->validate($metric);
$metric->saveOrFail(); $metric->saveOrFail();
return $metric; return $metric;
} }
public function update($id, array $array) { public function update($id, array $array)
{
$metric = $this->model->findOrFail($id); $metric = $this->model->findOrFail($id);
$metric->fill($array); $metric->fill($array);
$this->validate($metric); $this->validate($metric);
$metric->update($array); $metric->update($array);
return $metric; return $metric;
} }
} }
@@ -2,7 +2,8 @@
namespace CachetHQ\Cachet\Repositories\Metric; namespace CachetHQ\Cachet\Repositories\Metric;
interface MetricRepository { interface MetricRepository
{
public function all(); public function all();
@@ -5,30 +5,36 @@ namespace CachetHQ\Cachet\Repositories\MetricPoint;
use CachetHQ\Cachet\Repositories\EloquentRepository; use CachetHQ\Cachet\Repositories\EloquentRepository;
use MetricPoint; use MetricPoint;
class EloquentMetricRepository extends EloquentRepository implements MetricRepository { class EloquentMetricPointRepository extends EloquentRepository implements MetricRepository
{
protected $model; protected $model;
public function __construct(MetricPoint $model) { public function __construct(MetricPoint $model)
{
$this->model = $model; $this->model = $model;
} }
public function create(array $array) { public function create(array $array)
{
$metric = new $this->model($array); $metric = new $this->model($array);
$this->validate($metric); $this->validate($metric);
$metric->saveOrFail(); $metric->saveOrFail();
return $metric; return $metric;
} }
public function update($id, array $array) { public function update($id, array $array)
{
$metric = $this->model->findOrFail($id); $metric = $this->model->findOrFail($id);
$metric->fill($array); $metric->fill($array);
$this->validate($metric); $this->validate($metric);
$metric->update($array); $metric->update($array);
return $metric; return $metric;
} }
} }
@@ -2,7 +2,8 @@
namespace CachetHQ\Cachet\Repositories\MetricPoint; namespace CachetHQ\Cachet\Repositories\MetricPoint;
interface MetricPointRepository { interface MetricPointRepository
{
public function all(); public function all();
+8 -7
View File
@@ -2,18 +2,19 @@
namespace CachetHQ\Cachet\Service\Email; namespace CachetHQ\Cachet\Service\Email;
class EmailService implements ServiceInterface { class EmailService implements ServiceInterface
{
protected $properties; protected $properties;
public function register() { public function register()
{
} }
public function unregister() { public function unregister()
{
} }
public function fire($data) { public function fire($data)
{
} }
} }
@@ -2,7 +2,8 @@
namespace CachetHQ\Cachet\Service; namespace CachetHQ\Cachet\Service;
interface ServiceInterface { interface ServiceInterface
{
public function register(); public function register();
public function unregister(); public function unregister();
public function fire($data); public function fire($data);
@@ -4,8 +4,10 @@ namespace CachetHQ\Cachet\Support\ServiceProviders;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
class RepositoryServiceProvider extends ServiceProvider { class RepositoryServiceProvider extends ServiceProvider
public function register() { {
public function register()
{
$this->app->bind( $this->app->bind(
'CachetHQ\Cachet\Repositories\Component\ComponentRepository', 'CachetHQ\Cachet\Repositories\Component\ComponentRepository',
'CachetHQ\Cachet\Repositories\Component\EloquentComponentRepository' 'CachetHQ\Cachet\Repositories\Component\EloquentComponentRepository'
@@ -5,11 +5,15 @@ namespace CachetHQ\Cachet\Support\ServiceProviders;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use RecursiveDirectoryIterator; use RecursiveDirectoryIterator;
class RoutingServiceProvider extends ServiceProvider { class RoutingServiceProvider extends ServiceProvider
{
public function register() {} public function register()
{
}
public function boot() { public function boot()
{
$this->routesInDirectory(); $this->routesInDirectory();
} }
@@ -17,7 +21,8 @@ class RoutingServiceProvider extends ServiceProvider {
* Organise Routes * Organise Routes
* @param string $app * @param string $app
*/ */
private function routesInDirectory($app = '') { private function routesInDirectory($app = '')
{
$routeDir = app_path('routes/'.$app.($app !== '' ? '/' : null)); $routeDir = app_path('routes/'.$app.($app !== '' ? '/' : null));
$iterator = new RecursiveDirectoryIterator($routeDir); $iterator = new RecursiveDirectoryIterator($routeDir);
@@ -31,5 +36,4 @@ class RoutingServiceProvider extends ServiceProvider {
} }
} }
} }
} }
@@ -5,9 +5,11 @@ namespace CachetHQ\Cachet\Transformers;
use Component; use Component;
use League\Fractal\TransformerAbstract; use League\Fractal\TransformerAbstract;
class ComponentTransformer extends TransformerAbstract { class ComponentTransformer extends TransformerAbstract
{
public function transform(Component $component) { public function transform(Component $component)
{
return [ return [
'id' => (int) $component->id, 'id' => (int) $component->id,
'name' => $component->name, 'name' => $component->name,
@@ -19,5 +21,4 @@ class ComponentTransformer extends TransformerAbstract {
'updated_at' => $component->updated_at->timestamp, 'updated_at' => $component->updated_at->timestamp,
]; ];
} }
} }
@@ -5,9 +5,11 @@ namespace CachetHQ\Cachet\Transformers;
use Incident; use Incident;
use League\Fractal\TransformerAbstract; use League\Fractal\TransformerAbstract;
class IncidentTransformer extends TransformerAbstract { class IncidentTransformer extends TransformerAbstract
{
public function transform(Incident $incident) { public function transform(Incident $incident)
{
$component = $incident->component; $component = $incident->component;
$transformer = $component->getTransformer(); $transformer = $component->getTransformer();
@@ -2,12 +2,14 @@
namespace CachetHQ\Cachet\Transformers; namespace CachetHQ\Cachet\Transformers;
use MetricPoint;
use League\Fractal\TransformerAbstract; use League\Fractal\TransformerAbstract;
use MetricPoint;
class MetricPointTransformer extends TransformerAbstract { class MetricPointTransformer extends TransformerAbstract
{
public function transform(MetricPoint $metricPoint) { public function transform(MetricPoint $metricPoint)
{
return [ return [
'id' => (int) $metricPoint->id, 'id' => (int) $metricPoint->id,
'metric_id' => $metricPoint->metric_id, 'metric_id' => $metricPoint->metric_id,
@@ -16,5 +18,4 @@ class MetricPointTransformer extends TransformerAbstract {
'updated_at' => $metricPoint->updated_at->timestamp, 'updated_at' => $metricPoint->updated_at->timestamp,
]; ];
} }
} }
@@ -2,12 +2,14 @@
namespace CachetHQ\Cachet\Transformers; namespace CachetHQ\Cachet\Transformers;
use Metric;
use League\Fractal\TransformerAbstract; use League\Fractal\TransformerAbstract;
use Metric;
class MetricTransformer extends TransformerAbstract { class MetricTransformer extends TransformerAbstract
{
public function transform(Metric $metric) { public function transform(Metric $metric)
{
return [ return [
'id' => (int) $metric->id, 'id' => (int) $metric->id,
'name' => $metric->name, 'name' => $metric->name,
@@ -18,5 +20,4 @@ class MetricTransformer extends TransformerAbstract {
'updated_at' => $metric->updated_at->timestamp, 'updated_at' => $metric->updated_at->timestamp,
]; ];
} }
} }
+6 -6
View File
@@ -1,6 +1,6 @@
<?php <?php
return array( return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -93,7 +93,7 @@ return array(
| |
*/ */
'providers' => array( 'providers' => [
'Illuminate\Foundation\Providers\ArtisanServiceProvider', 'Illuminate\Foundation\Providers\ArtisanServiceProvider',
'Illuminate\Auth\AuthServiceProvider', 'Illuminate\Auth\AuthServiceProvider',
@@ -128,7 +128,7 @@ return array(
'CachetHQ\Cachet\Support\ServiceProviders\RepositoryServiceProvider', 'CachetHQ\Cachet\Support\ServiceProviders\RepositoryServiceProvider',
'CachetHQ\Cachet\Support\ServiceProviders\RoutingServiceProvider', 'CachetHQ\Cachet\Support\ServiceProviders\RoutingServiceProvider',
), ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -154,7 +154,7 @@ return array(
| |
*/ */
'aliases' => array( 'aliases' => [
'App' => 'Illuminate\Support\Facades\App', 'App' => 'Illuminate\Support\Facades\App',
'Artisan' => 'Illuminate\Support\Facades\Artisan', 'Artisan' => 'Illuminate\Support\Facades\Artisan',
@@ -199,6 +199,6 @@ return array(
'API' => 'Dingo\Api\Facade\API', 'API' => 'Dingo\Api\Facade\API',
'RSS' => 'Thujohn\Rss\RssFacade', 'RSS' => 'Thujohn\Rss\RssFacade',
), ],
); ];
+4 -4
View File
@@ -1,6 +1,6 @@
<?php <?php
return array( return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -58,7 +58,7 @@ return array(
| |
*/ */
'reminder' => array( 'reminder' => [
'email' => 'emails.auth.reminder', 'email' => 'emails.auth.reminder',
@@ -66,6 +66,6 @@ return array(
'expire' => 60, 'expire' => 60,
), ],
); ];
+5 -5
View File
@@ -1,6 +1,6 @@
<?php <?php
return array( return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -67,11 +67,11 @@ return array(
| |
*/ */
'memcached' => array( 'memcached' => [
array('host' => '127.0.0.1', 'port' => 11211, 'weight' => 100), ['host' => '127.0.0.1', 'port' => 11211, 'weight' => 100],
), ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -86,4 +86,4 @@ return array(
'prefix' => 'laravel', 'prefix' => 'laravel',
); ];
+2 -4
View File
@@ -1,6 +1,6 @@
<?php <?php
return array( return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -13,6 +13,4 @@ return array(
| |
*/ */
];
);
+16 -16
View File
@@ -1,6 +1,6 @@
<?php <?php
return array( return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -44,15 +44,15 @@ return array(
| |
*/ */
'connections' => array( 'connections' => [
'sqlite' => array( 'sqlite' => [
'driver' => 'sqlite', 'driver' => 'sqlite',
'database' => __DIR__.'/../database/'.$_ENV['DB_DATABASE'], 'database' => __DIR__.'/../database/'.$_ENV['DB_DATABASE'],
'prefix' => '', 'prefix' => '',
), ],
'mysql' => array( 'mysql' => [
'driver' => 'mysql', 'driver' => 'mysql',
'host' => $_ENV['DB_HOST'], 'host' => $_ENV['DB_HOST'],
'database' => $_ENV['DB_DATABASE'], 'database' => $_ENV['DB_DATABASE'],
@@ -61,9 +61,9 @@ return array(
'charset' => 'utf8', 'charset' => 'utf8',
'collation' => 'utf8_unicode_ci', 'collation' => 'utf8_unicode_ci',
'prefix' => '', 'prefix' => '',
), ],
'pgsql' => array( 'pgsql' => [
'driver' => 'pgsql', 'driver' => 'pgsql',
'host' => $_ENV['DB_HOST'], 'host' => $_ENV['DB_HOST'],
'database' => $_ENV['DB_DATABASE'], 'database' => $_ENV['DB_DATABASE'],
@@ -72,18 +72,18 @@ return array(
'charset' => 'utf8', 'charset' => 'utf8',
'prefix' => '', 'prefix' => '',
'schema' => 'public', 'schema' => 'public',
), ],
'sqlsrv' => array( 'sqlsrv' => [
'driver' => 'sqlsrv', 'driver' => 'sqlsrv',
'host' => $_ENV['DB_HOST'], 'host' => $_ENV['DB_HOST'],
'database' => $_ENV['DB_DATABASE'], 'database' => $_ENV['DB_DATABASE'],
'username' => $_ENV['DB_USERNAME'], 'username' => $_ENV['DB_USERNAME'],
'password' => $_ENV['DB_PASSWORD'], 'password' => $_ENV['DB_PASSWORD'],
'prefix' => '', 'prefix' => '',
), ],
), ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -109,16 +109,16 @@ return array(
| |
*/ */
'redis' => array( 'redis' => [
'cluster' => false, 'cluster' => false,
'default' => array( 'default' => [
'host' => '127.0.0.1', 'host' => '127.0.0.1',
'port' => 6379, 'port' => 6379,
'database' => 0, 'database' => 0,
), ],
), ],
); ];
+6 -6
View File
@@ -3,10 +3,10 @@
$dbURL = parse_url(getenv('CLEARDB_DATABASE_URL')); $dbURL = parse_url(getenv('CLEARDB_DATABASE_URL'));
$dbName = substr($dbURL["path"], 1); $dbName = substr($dbURL["path"], 1);
return array( return [
'default' => 'cleardb', 'default' => 'cleardb',
'connections' => array( 'connections' => [
'cleardb' => array( 'cleardb' => [
'driver' => 'mysql', 'driver' => 'mysql',
'host' => $dbURL['host'], 'host' => $dbURL['host'],
'database' => $dbName, 'database' => $dbName,
@@ -15,6 +15,6 @@ return array(
'charset' => 'utf8', 'charset' => 'utf8',
'collation' => 'utf8_unicode_ci', 'collation' => 'utf8_unicode_ci',
'prefix' => '', 'prefix' => '',
), ],
) ],
); ];
+2 -2
View File
@@ -1,6 +1,6 @@
<?php <?php
return array( return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -17,4 +17,4 @@ return array(
'url' => 'http://cachet.io.dev', 'url' => 'http://cachet.io.dev',
); ];
+3 -3
View File
@@ -1,6 +1,6 @@
<?php <?php
return array( return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -54,7 +54,7 @@ return array(
| |
*/ */
'from' => array('address' => null, 'name' => null), 'from' => ['address' => null, 'name' => null],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -121,4 +121,4 @@ return array(
'pretend' => false, 'pretend' => false,
); ];
+6 -6
View File
@@ -78,7 +78,7 @@ return [
'auth' => [ 'auth' => [
'basic' => function ($app) { 'basic' => function ($app) {
return new Dingo\Api\Auth\BasicProvider($app['auth']); return new Dingo\Api\Auth\BasicProvider($app['auth']);
} },
], ],
/* /*
@@ -101,15 +101,15 @@ return [
'authenticated' => [ 'authenticated' => [
'limit' => 0, 'limit' => 0,
'reset' => 60 'reset' => 60,
], ],
'unauthenticated' => [ 'unauthenticated' => [
'limit' => 0, 'limit' => 0,
'reset' => 60 'reset' => 60,
], ],
'exceeded' => 'API rate limit has been exceeded.' 'exceeded' => 'API rate limit has been exceeded.',
], ],
@@ -126,7 +126,7 @@ return [
*/ */
'transformer' => function ($app) { 'transformer' => function ($app) {
$fractal = new League\Fractal\Manager; $fractal = new League\Fractal\Manager();
return new Dingo\Api\Transformer\FractalTransformer($fractal); return new Dingo\Api\Transformer\FractalTransformer($fractal);
}, },
@@ -146,7 +146,7 @@ return [
'formats' => [ 'formats' => [
'json' => new Dingo\Api\Http\ResponseFormat\JsonResponseFormat 'json' => new Dingo\Api\Http\ResponseFormat\JsonResponseFormat(),
] ]
+16 -16
View File
@@ -1,6 +1,6 @@
<?php <?php
return array( return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -28,42 +28,42 @@ return array(
| |
*/ */
'connections' => array( 'connections' => [
'sync' => array( 'sync' => [
'driver' => 'sync', 'driver' => 'sync',
), ],
'beanstalkd' => array( 'beanstalkd' => [
'driver' => 'beanstalkd', 'driver' => 'beanstalkd',
'host' => 'localhost', 'host' => 'localhost',
'queue' => 'default', 'queue' => 'default',
'ttr' => 60, 'ttr' => 60,
), ],
'sqs' => array( 'sqs' => [
'driver' => 'sqs', 'driver' => 'sqs',
'key' => 'your-public-key', 'key' => 'your-public-key',
'secret' => 'your-secret-key', 'secret' => 'your-secret-key',
'queue' => 'your-queue-url', 'queue' => 'your-queue-url',
'region' => 'us-east-1', 'region' => 'us-east-1',
), ],
'iron' => array( 'iron' => [
'driver' => 'iron', 'driver' => 'iron',
'host' => 'mq-aws-us-east-1.iron.io', 'host' => 'mq-aws-us-east-1.iron.io',
'token' => 'your-token', 'token' => 'your-token',
'project' => 'your-project-id', 'project' => 'your-project-id',
'queue' => 'your-queue-name', 'queue' => 'your-queue-name',
'encrypt' => true, 'encrypt' => true,
), ],
'redis' => array( 'redis' => [
'driver' => 'redis', 'driver' => 'redis',
'queue' => 'default', 'queue' => 'default',
), ],
), ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -76,10 +76,10 @@ return array(
| |
*/ */
'failed' => array( 'failed' => [
'database' => 'mysql', 'table' => 'failed_jobs', 'database' => 'mysql', 'table' => 'failed_jobs',
), ],
); ];
+9 -9
View File
@@ -1,6 +1,6 @@
<?php <?php
return array( return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -26,18 +26,18 @@ return array(
| |
*/ */
'connections' => array( 'connections' => [
'production' => array( 'production' => [
'host' => '', 'host' => '',
'username' => '', 'username' => '',
'password' => '', 'password' => '',
'key' => '', 'key' => '',
'keyphrase' => '', 'keyphrase' => '',
'root' => '/var/www', 'root' => '/var/www',
), ],
), ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -50,10 +50,10 @@ return array(
| |
*/ */
'groups' => array( 'groups' => [
'web' => array('production') 'web' => ['production'],
), ],
); ];
+8 -8
View File
@@ -1,6 +1,6 @@
<?php <?php
return array( return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -14,18 +14,18 @@ return array(
| |
*/ */
'mailgun' => array( 'mailgun' => [
'domain' => '', 'domain' => '',
'secret' => '', 'secret' => '',
), ],
'mandrill' => array( 'mandrill' => [
'secret' => '', 'secret' => '',
), ],
'stripe' => array( 'stripe' => [
'model' => 'User', 'model' => 'User',
'secret' => '', 'secret' => '',
), ],
); ];
+3 -3
View File
@@ -1,6 +1,6 @@
<?php <?php
return array( return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -83,7 +83,7 @@ return array(
| |
*/ */
'lottery' => array(2, 100), 'lottery' => [2, 100],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -137,4 +137,4 @@ return array(
'secure' => false, 'secure' => false,
); ];
+2 -2
View File
@@ -1,6 +1,6 @@
<?php <?php
return array( return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -17,4 +17,4 @@ return array(
'driver' => 'array', 'driver' => 'array',
); ];
+2 -2
View File
@@ -1,6 +1,6 @@
<?php <?php
return array( return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -18,4 +18,4 @@ return array(
'driver' => 'array', 'driver' => 'array',
); ];
+3 -3
View File
@@ -1,6 +1,6 @@
<?php <?php
return array( return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -13,7 +13,7 @@ return array(
| |
*/ */
'paths' => array(__DIR__.'/../views'), 'paths' => [__DIR__.'/../views'],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -28,4 +28,4 @@ return array(
'pagination' => 'pagination::slider-3', 'pagination' => 'pagination::slider-3',
); ];
+2 -2
View File
@@ -1,6 +1,6 @@
<?php <?php
return array( return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -28,4 +28,4 @@ return array(
'email' => '', 'email' => '',
); ];
+9 -4
View File
@@ -3,12 +3,14 @@
/** /**
* Logs users into their account * Logs users into their account
*/ */
class AuthController extends Controller { class AuthController extends Controller
{
/** /**
* Shows the login view. * Shows the login view.
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function showLogin() { public function showLogin()
{
return View::make('auth.login'); return View::make('auth.login');
} }
@@ -16,7 +18,8 @@ class AuthController extends Controller {
* Logs the user in. * Logs the user in.
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function postLogin() { public function postLogin()
{
if (Auth::attempt(Input::only(['email', 'password']))) { if (Auth::attempt(Input::only(['email', 'password']))) {
return Redirect::intended('dashboard'); return Redirect::intended('dashboard');
} else { } else {
@@ -30,8 +33,10 @@ class AuthController extends Controller {
* Logs the user out, deleting their session etc. * Logs the user out, deleting their session etc.
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function logoutAction() { public function logoutAction()
{
Auth::logout(); Auth::logout();
return Redirect::to('/'); return Redirect::to('/');
} }
} }
+17 -10
View File
@@ -1,16 +1,18 @@
<?php <?php
class DashComponentController extends Controller { class DashComponentController extends Controller
{
/** /**
* Shows the components view. * Shows the components view.
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function showComponents() { public function showComponents()
{
$components = Component::all(); $components = Component::all();
return View::make('dashboard.components')->with([ return View::make('dashboard.components')->with([
'pageTitle' => 'Components - Dashboard', 'pageTitle' => 'Components - Dashboard',
'components' => $components 'components' => $components,
]); ]);
} }
@@ -19,11 +21,11 @@ class DashComponentController extends Controller {
* @param Component $component * @param Component $component
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function showEditComponent(Component $component) { public function showEditComponent(Component $component)
{
return View::make('dashboard.component-edit')->with([ return View::make('dashboard.component-edit')->with([
'pageTitle' => 'Editing "'.$component->name.'" Component - Dashboard', 'pageTitle' => 'Editing "'.$component->name.'" Component - Dashboard',
'component' => $component 'component' => $component,
]); ]);
} }
@@ -31,7 +33,8 @@ class DashComponentController extends Controller {
* Updates a component. * Updates a component.
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function updateComponentAction(Component $component) { public function updateComponentAction(Component $component)
{
$_component = Input::get('component'); $_component = Input::get('component');
$component->update($_component); $component->update($_component);
@@ -42,7 +45,8 @@ class DashComponentController extends Controller {
* Shows the add component view. * Shows the add component view.
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function showAddComponent() { public function showAddComponent()
{
return View::make('dashboard.component-add')->with([ return View::make('dashboard.component-add')->with([
'pageTitle' => 'Add Component - Dashboard', 'pageTitle' => 'Add Component - Dashboard',
]); ]);
@@ -52,7 +56,8 @@ class DashComponentController extends Controller {
* Creates a new component. * Creates a new component.
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function createComponentAction() { public function createComponentAction()
{
$_component = Input::get('component'); $_component = Input::get('component');
$component = Component::create($_component); $component = Component::create($_component);
@@ -64,8 +69,10 @@ class DashComponentController extends Controller {
* @param Component $component * @param Component $component
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function deleteComponentAction(Component $component) { public function deleteComponentAction(Component $component)
{
$component->delete(); $component->delete();
return Redirect::back(); return Redirect::back();
} }
} }
+13 -7
View File
@@ -1,16 +1,18 @@
<?php <?php
class DashIncidentController extends Controller { class DashIncidentController extends Controller
{
/** /**
* Shows the incidents view. * Shows the incidents view.
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function showIncidents() { public function showIncidents()
{
$incidents = Incident::all(); $incidents = Incident::all();
return View::make('dashboard.incidents')->with([ return View::make('dashboard.incidents')->with([
'pageTitle' => 'Incidents - Dashboard', 'pageTitle' => 'Incidents - Dashboard',
'incidents' => $incidents 'incidents' => $incidents,
]); ]);
} }
@@ -18,7 +20,8 @@ class DashIncidentController extends Controller {
* Shows the add incident view. * Shows the add incident view.
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function showAddIncident() { public function showAddIncident()
{
return View::make('dashboard.incident-add')->with([ return View::make('dashboard.incident-add')->with([
'pageTitle' => 'Add Incident - Dashboard', 'pageTitle' => 'Add Incident - Dashboard',
]); ]);
@@ -28,7 +31,8 @@ class DashIncidentController extends Controller {
* Shows the add incident template view. * Shows the add incident template view.
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function showAddIncidentTemplate() { public function showAddIncidentTemplate()
{
return View::make('dashboard.incident-template')->with([ return View::make('dashboard.incident-template')->with([
'pageTitle' => 'Add Incident Template - Dashboard', 'pageTitle' => 'Add Incident Template - Dashboard',
]); ]);
@@ -38,7 +42,8 @@ class DashIncidentController extends Controller {
* Creates a new incident template. * Creates a new incident template.
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function createIncidentTemplateAction() { public function createIncidentTemplateAction()
{
$_template = Input::get('template'); $_template = Input::get('template');
$template = IncidentTemplate::create($_template); $template = IncidentTemplate::create($_template);
@@ -49,7 +54,8 @@ class DashIncidentController extends Controller {
* Creates a new incident. * Creates a new incident.
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function createIncidentAction() { public function createIncidentAction()
{
$_incident = Input::get('incident'); $_incident = Input::get('incident');
$incident = Incident::create($_incident); $incident = Incident::create($_incident);
+8 -5
View File
@@ -1,13 +1,15 @@
<?php <?php
class DashSettingsController extends Controller { class DashSettingsController extends Controller
{
/** /**
* Shows the settings view. * Shows the settings view.
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function showSettings() { public function showSettings()
{
return View::make('dashboard.settings')->with([ return View::make('dashboard.settings')->with([
'pageTitle' => 'Settings - Dashboard' 'pageTitle' => 'Settings - Dashboard',
]); ]);
} }
@@ -15,7 +17,8 @@ class DashSettingsController extends Controller {
* Updates the statsu page settings. * Updates the statsu page settings.
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function postSettings() { public function postSettings()
{
$settings = Input::all(); $settings = Input::all();
foreach ($settings as $settingName => $settingValue) { foreach ($settings as $settingName => $settingValue) {
@@ -31,7 +34,7 @@ class DashSettingsController extends Controller {
$setting = Setting::firstOrCreate([ $setting = Setting::firstOrCreate([
'name' => $settingName, 'name' => $settingName,
])->update([ ])->update([
'value' => $settingValue 'value' => $settingValue,
]); ]);
} }
+10 -6
View File
@@ -1,11 +1,13 @@
<?php <?php
class DashboardController extends Controller { class DashboardController extends Controller
{
/** /**
* Shows the dashboard view. * Shows the dashboard view.
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function showDashboard() { public function showDashboard()
{
return View::make('dashboard.index'); return View::make('dashboard.index');
} }
@@ -13,9 +15,10 @@ class DashboardController extends Controller {
* Shows the metrics view. * Shows the metrics view.
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function showMetrics() { public function showMetrics()
{
return View::make('dashboard.metrics')->with([ return View::make('dashboard.metrics')->with([
'pageTitle' => 'Metrics - Dashboard' 'pageTitle' => 'Metrics - Dashboard',
]); ]);
} }
@@ -23,9 +26,10 @@ class DashboardController extends Controller {
* Shows the notifications view. * Shows the notifications view.
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function showNotifications() { public function showNotifications()
{
return View::make('dashboard.notifications')->with([ return View::make('dashboard.notifications')->with([
'pageTitle' => 'Notifications - Dashboard' 'pageTitle' => 'Notifications - Dashboard',
]); ]);
} }
} }
+6 -3
View File
@@ -1,12 +1,14 @@
<?php <?php
class HomeController extends Controller { class HomeController extends Controller
{
/** /**
* @var Component $component * @var Component $component
*/ */
protected $component; protected $component;
public function __construct(Component $component) { public function __construct(Component $component)
{
$this->component = $component; $this->component = $component;
} }
@@ -14,7 +16,8 @@ class HomeController extends Controller {
* Returns the rendered Blade templates. * Returns the rendered Blade templates.
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function showIndex() { public function showIndex()
{
return View::make('index', ['components' => $this->component->all()]); return View::make('index', ['components' => $this->component->all()]);
} }
} }
+5 -3
View File
@@ -1,11 +1,13 @@
<?php <?php
class RSSController extends Controller { class RSSController extends Controller
{
/** /**
* Generates an RSS feed of all incidents. * Generates an RSS feed of all incidents.
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function feedAction() { public function feedAction()
{
$feed = RSS::feed('2.0', 'UTF-8'); $feed = RSS::feed('2.0', 'UTF-8');
$feed->channel([ $feed->channel([
'title' => Setting::get('app_name'), 'title' => Setting::get('app_name'),
@@ -26,7 +28,7 @@ class RSSController extends Controller {
'component' => $componentName, 'component' => $componentName,
'status' => $incident->humanStatus, 'status' => $incident->humanStatus,
'created_at' => $incident->created_at, 'created_at' => $incident->created_at,
'updated_at' => $incident->updated_at 'updated_at' => $incident->updated_at,
]); ]);
}); });
+10 -6
View File
@@ -1,7 +1,9 @@
<?php <?php
class SetupController extends Controller { class SetupController extends Controller
public function __construct() { {
public function __construct()
{
$this->beforeFilter('csrf', ['only' => ['postCachet']]); $this->beforeFilter('csrf', ['only' => ['postCachet']]);
} }
@@ -9,9 +11,10 @@ class SetupController extends Controller {
* Returns the setup page. * Returns the setup page.
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function getIndex() { public function getIndex()
{
return View::make('setup')->with([ return View::make('setup')->with([
'pageTitle' => 'Setup' 'pageTitle' => 'Setup',
]); ]);
} }
@@ -19,7 +22,8 @@ class SetupController extends Controller {
* Handles the actual app setup. * Handles the actual app setup.
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function postIndex() { public function postIndex()
{
$postData = Input::get(); $postData = Input::get();
$v = Validator::make($postData, [ $v = Validator::make($postData, [
@@ -47,7 +51,7 @@ class SetupController extends Controller {
$settings = array_get($postData, 'settings'); $settings = array_get($postData, 'settings');
foreach ($settings as $settingName => $settingValue) { foreach ($settings as $settingName => $settingValue) {
$setting = new Setting; $setting = new Setting();
$setting->name = $settingName; $setting->name = $settingName;
$setting->value = $settingValue; $setting->value = $settingValue;
$setting->save(); $setting->save();
@@ -1,9 +1,10 @@
<?php <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateIncidentsTable extends Migration { class CreateIncidentsTable extends Migration
{
/** /**
* Run the migrations. * Run the migrations.
@@ -12,8 +13,7 @@ class CreateIncidentsTable extends Migration {
*/ */
public function up() public function up()
{ {
Schema::create('incidents', function(Blueprint $table) Schema::create('incidents', function (Blueprint $table) {
{
$table->increments('id'); $table->increments('id');
$table->tinyInteger('component')->default(1); $table->tinyInteger('component')->default(1);
$table->string('name'); $table->string('name');
@@ -36,5 +36,4 @@ class CreateIncidentsTable extends Migration {
{ {
Schema::drop('incidents'); Schema::drop('incidents');
} }
} }
@@ -1,9 +1,10 @@
<?php <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateComponentsTable extends Migration { class CreateComponentsTable extends Migration
{
/** /**
* Run the migrations. * Run the migrations.
@@ -12,8 +13,7 @@ class CreateComponentsTable extends Migration {
*/ */
public function up() public function up()
{ {
Schema::create('components', function(Blueprint $table) Schema::create('components', function (Blueprint $table) {
{
$table->increments('id'); $table->increments('id');
$table->string('name'); $table->string('name');
$table->string('description')->nullable()->default(null); $table->string('description')->nullable()->default(null);
@@ -33,5 +33,4 @@ class CreateComponentsTable extends Migration {
{ {
Schema::drop('components'); Schema::drop('components');
} }
} }
@@ -1,9 +1,10 @@
<?php <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateSettingsTable extends Migration { class CreateSettingsTable extends Migration
{
/** /**
* Run the migrations. * Run the migrations.
@@ -12,8 +13,7 @@ class CreateSettingsTable extends Migration {
*/ */
public function up() public function up()
{ {
Schema::create('settings', function(Blueprint $table) Schema::create('settings', function (Blueprint $table) {
{
$table->increments('id'); $table->increments('id');
$table->string('name'); $table->string('name');
$table->text('value')->nullable()->default(null); $table->text('value')->nullable()->default(null);
@@ -30,5 +30,4 @@ class CreateSettingsTable extends Migration {
{ {
Schema::drop('settings'); Schema::drop('settings');
} }
} }
@@ -1,9 +1,10 @@
<?php <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateWebHooksTable extends Migration { class CreateWebHooksTable extends Migration
{
/** /**
* Run the migrations. * Run the migrations.
@@ -12,11 +13,10 @@ class CreateWebHooksTable extends Migration {
*/ */
public function up() public function up()
{ {
Schema::create('web_hooks', function(Blueprint $table) Schema::create('web_hooks', function (Blueprint $table) {
{
$table->increments('id'); $table->increments('id');
$table->string('name')->nullable(FALSE); $table->string('name')->nullable(false);
$table->string('endpoint')->nullable(FALSE); $table->string('endpoint')->nullable(false);
$table->tinyInteger('hook_type')->default(0); // When should this web hook be called? $table->tinyInteger('hook_type')->default(0); // When should this web hook be called?
$table->tinyInteger('request_type')->default(0); // ENUM: GET, POST, PUT, DELETE etc $table->tinyInteger('request_type')->default(0); // ENUM: GET, POST, PUT, DELETE etc
$table->boolean('active')->default(0); $table->boolean('active')->default(0);
@@ -37,5 +37,4 @@ class CreateWebHooksTable extends Migration {
{ {
Schema::drop('web_hooks'); Schema::drop('web_hooks');
} }
} }
@@ -1,9 +1,10 @@
<?php <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateWebHookResponsesTable extends Migration { class CreateWebHookResponsesTable extends Migration
{
/** /**
* Run the migrations. * Run the migrations.
@@ -12,11 +13,10 @@ class CreateWebHookResponsesTable extends Migration {
*/ */
public function up() public function up()
{ {
Schema::create('web_hook_response', function(Blueprint $table) Schema::create('web_hook_response', function (Blueprint $table) {
{
$table->increments('id'); $table->increments('id');
$table->integer('hook_id')->unsigned(); $table->integer('hook_id')->unsigned();
$table->tinyInteger('response_code')->nullable(FALSE); // This should return something like 200, 301 etc. $table->tinyInteger('response_code')->nullable(false); // This should return something like 200, 301 etc.
$table->string('response_type'); // application/json etc. $table->string('response_type'); // application/json etc.
$table->text('sent_headers'); $table->text('sent_headers');
$table->longText('sent_body'); // What we sent the web hook $table->longText('sent_body'); // What we sent the web hook
@@ -38,5 +38,4 @@ class CreateWebHookResponsesTable extends Migration {
{ {
Schema::drop('web_hook_response'); Schema::drop('web_hook_response');
} }
} }
@@ -1,9 +1,10 @@
<?php <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateUsersTable extends Migration { class CreateUsersTable extends Migration
{
/** /**
* Run the migrations. * Run the migrations.
@@ -12,8 +13,7 @@ class CreateUsersTable extends Migration {
*/ */
public function up() public function up()
{ {
Schema::create('users', function(Blueprint $table) Schema::create('users', function (Blueprint $table) {
{
$table->increments('id'); $table->increments('id');
$table->string('username', 200)->nullable(false); $table->string('username', 200)->nullable(false);
$table->string('password')->nullable(false); $table->string('password')->nullable(false);
@@ -37,5 +37,4 @@ class CreateUsersTable extends Migration {
{ {
Schema::drop('users'); Schema::drop('users');
} }
} }
@@ -1,9 +1,10 @@
<?php <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateIncidentTemplatesTable extends Migration { class CreateIncidentTemplatesTable extends Migration
{
/** /**
* Run the migrations. * Run the migrations.
@@ -12,8 +13,7 @@ class CreateIncidentTemplatesTable extends Migration {
*/ */
public function up() public function up()
{ {
Schema::create('incident_templates', function(Blueprint $table) Schema::create('incident_templates', function (Blueprint $table) {
{
$table->increments('id'); $table->increments('id');
$table->string('name')->nullable(false); $table->string('name')->nullable(false);
$table->string('slug', 50)->nullable(false); $table->string('slug', 50)->nullable(false);
@@ -34,5 +34,4 @@ class CreateIncidentTemplatesTable extends Migration {
{ {
Schema::drop('incident_templates'); Schema::drop('incident_templates');
} }
} }
@@ -1,9 +1,10 @@
<?php <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateMetricsTable extends Migration { class CreateMetricsTable extends Migration
{
/** /**
* Run the migrations. * Run the migrations.
@@ -12,8 +13,7 @@ class CreateMetricsTable extends Migration {
*/ */
public function up() public function up()
{ {
Schema::create('metrics', function(Blueprint $table) Schema::create('metrics', function (Blueprint $table) {
{
$table->increments('id'); $table->increments('id');
$table->string('name')->nullable(false); $table->string('name')->nullable(false);
$table->string('suffix')->nullable(false); $table->string('suffix')->nullable(false);
@@ -32,5 +32,4 @@ class CreateMetricsTable extends Migration {
{ {
Schema::drop('metrics'); Schema::drop('metrics');
} }
} }
@@ -1,9 +1,10 @@
<?php <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateMetricPointsTable extends Migration { class CreateMetricPointsTable extends Migration
{
/** /**
* Run the migrations. * Run the migrations.
@@ -12,8 +13,7 @@ class CreateMetricPointsTable extends Migration {
*/ */
public function up() public function up()
{ {
Schema::create('metric_points', function(Blueprint $table) Schema::create('metric_points', function (Blueprint $table) {
{
$table->increments('id'); $table->increments('id');
$table->integer('metric_id')->unsigned(); $table->integer('metric_id')->unsigned();
$table->integer('value')->unsigned(); $table->integer('value')->unsigned();
@@ -32,5 +32,4 @@ class CreateMetricPointsTable extends Migration {
{ {
Schema::drop('metric_points'); Schema::drop('metric_points');
} }
} }
@@ -1,9 +1,10 @@
<?php <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class UserIdColumnForComponents extends Migration { class UserIdColumnForComponents extends Migration
{
/** /**
* Run the migrations. * Run the migrations.
@@ -12,8 +13,7 @@ class UserIdColumnForComponents extends Migration {
*/ */
public function up() public function up()
{ {
Schema::table('components', function(Blueprint $table) Schema::table('components', function (Blueprint $table) {
{
$table->unsignedInteger('user_id')->nullable(); $table->unsignedInteger('user_id')->nullable();
$table->foreign('user_id')->references('id')->on('users')->onDelete('SET NULL')->onUpdate('NO ACTION'); $table->foreign('user_id')->references('id')->on('users')->onDelete('SET NULL')->onUpdate('NO ACTION');
@@ -27,10 +27,8 @@ class UserIdColumnForComponents extends Migration {
*/ */
public function down() public function down()
{ {
Schema::table('components', function(Blueprint $table) Schema::table('components', function (Blueprint $table) {
{
$table->dropColumn('user_id'); $table->dropColumn('user_id');
}); });
} }
} }
@@ -1,9 +1,10 @@
<?php <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class UserIdColumnForIncidents extends Migration { class UserIdColumnForIncidents extends Migration
{
/** /**
* Run the migrations. * Run the migrations.
@@ -12,8 +13,7 @@ class UserIdColumnForIncidents extends Migration {
*/ */
public function up() public function up()
{ {
Schema::table('incidents', function(Blueprint $table) Schema::table('incidents', function (Blueprint $table) {
{
$table->unsignedInteger('user_id')->nullable(); $table->unsignedInteger('user_id')->nullable();
$table->foreign('user_id')->references('id')->on('users')->onDelete('SET NULL')->onUpdate('NO ACTION'); $table->foreign('user_id')->references('id')->on('users')->onDelete('SET NULL')->onUpdate('NO ACTION');
@@ -27,10 +27,8 @@ class UserIdColumnForIncidents extends Migration {
*/ */
public function down() public function down()
{ {
Schema::table('incidents', function(Blueprint $table) Schema::table('incidents', function (Blueprint $table) {
{
$table->dropColumn('user_id'); $table->dropColumn('user_id');
}); });
} }
} }
@@ -1,9 +1,10 @@
<?php <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateSubscribersTable extends Migration { class CreateSubscribersTable extends Migration
{
/** /**
* Run the migrations. * Run the migrations.
@@ -12,8 +13,7 @@ class CreateSubscribersTable extends Migration {
*/ */
public function up() public function up()
{ {
Schema::create('subscribers', function(Blueprint $table) Schema::create('subscribers', function (Blueprint $table) {
{
$table->increments('id'); $table->increments('id');
$table->string('email')->nullable(false); $table->string('email')->nullable(false);
$table->timestamps(); $table->timestamps();
@@ -30,5 +30,4 @@ class CreateSubscribersTable extends Migration {
{ {
Schema::drop('subscribers'); Schema::drop('subscribers');
} }
} }
@@ -1,9 +1,10 @@
<?php <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateServicesTable extends Migration { class CreateServicesTable extends Migration
{
/** /**
* Run the migrations. * Run the migrations.
@@ -12,8 +13,7 @@ class CreateServicesTable extends Migration {
*/ */
public function up() public function up()
{ {
Schema::create('services', function(Blueprint $table) Schema::create('services', function (Blueprint $table) {
{
$table->increments('id'); $table->increments('id');
$table->string('type')->nullable(false); $table->string('type')->nullable(false);
@@ -33,5 +33,4 @@ class CreateServicesTable extends Migration {
{ {
Schema::drop('services'); Schema::drop('services');
} }
} }
@@ -1,9 +1,10 @@
<?php <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AlterTableIncidentsRenameComponentColumn extends Migration { class AlterTableIncidentsRenameComponentColumn extends Migration
{
/** /**
* Run the migrations. * Run the migrations.
@@ -12,8 +13,7 @@ class AlterTableIncidentsRenameComponentColumn extends Migration {
*/ */
public function up() public function up()
{ {
Schema::table('incidents', function(Blueprint $table) Schema::table('incidents', function (Blueprint $table) {
{
DB::statement("ALTER TABLE `incidents` CHANGE `component` `component_id` TINYINT(4) NOT NULL DEFAULT '1'"); DB::statement("ALTER TABLE `incidents` CHANGE `component` `component_id` TINYINT(4) NOT NULL DEFAULT '1'");
}); });
} }
@@ -25,10 +25,8 @@ class AlterTableIncidentsRenameComponentColumn extends Migration {
*/ */
public function down() public function down()
{ {
Schema::table('incidents', function(Blueprint $table) Schema::table('incidents', function (Blueprint $table) {
{
DB::statement("ALTER TABLE `incidents` CHANGE `component_id` `component` TINYINT(4) NOT NULL DEFAULT '1'"); DB::statement("ALTER TABLE `incidents` CHANGE `component_id` `component` TINYINT(4) NOT NULL DEFAULT '1'");
}); });
} }
} }
@@ -1,9 +1,10 @@
<?php <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AlterIncidentsTableMoveUserIdColumn extends Migration { class AlterIncidentsTableMoveUserIdColumn extends Migration
{
/** /**
* Run the migrations. * Run the migrations.
@@ -12,8 +13,7 @@ class AlterIncidentsTableMoveUserIdColumn extends Migration {
*/ */
public function up() public function up()
{ {
Schema::table('incidents', function(Blueprint $table) Schema::table('incidents', function (Blueprint $table) {
{
DB::statement('ALTER TABLE `incidents` MODIFY COLUMN `user_id` INT(10) UNSIGNED DEFAULT NULL AFTER `component_id`;'); DB::statement('ALTER TABLE `incidents` MODIFY COLUMN `user_id` INT(10) UNSIGNED DEFAULT NULL AFTER `component_id`;');
}); });
} }
@@ -25,11 +25,9 @@ class AlterIncidentsTableMoveUserIdColumn extends Migration {
*/ */
public function down() public function down()
{ {
Schema::table('incidents', function(Blueprint $table) Schema::table('incidents', function (Blueprint $table) {
{
DB::statement('ALTER TABLE `incidents` MODIFY COLUMN `user_id` INT(10) UNSIGNED DEFAULT NULL AFTER `deleted_at`;'); DB::statement('ALTER TABLE `incidents` MODIFY COLUMN `user_id` INT(10) UNSIGNED DEFAULT NULL AFTER `deleted_at`;');
}); });
} }
} }
@@ -1,9 +1,10 @@
<?php <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AlterTableIncidentsRemoveDefaultComponent extends Migration { class AlterTableIncidentsRemoveDefaultComponent extends Migration
{
/** /**
* Run the migrations. * Run the migrations.
@@ -12,8 +13,7 @@ class AlterTableIncidentsRemoveDefaultComponent extends Migration {
*/ */
public function up() public function up()
{ {
Schema::table('incidents', function(Blueprint $table) Schema::table('incidents', function (Blueprint $table) {
{
DB::statement("ALTER TABLE `incidents` CHANGE `component_id` `component_id` TINYINT(4) NOT NULL DEFAULT '0';"); DB::statement("ALTER TABLE `incidents` CHANGE `component_id` `component_id` TINYINT(4) NOT NULL DEFAULT '0';");
}); });
} }
@@ -25,10 +25,8 @@ class AlterTableIncidentsRemoveDefaultComponent extends Migration {
*/ */
public function down() public function down()
{ {
Schema::table('incidents', function(Blueprint $table) Schema::table('incidents', function (Blueprint $table) {
{
DB::statement("ALTER TABLE `incidents` CHANGE `component_id` `component_id` TINYINT(4) NOT NULL DEFAULT '1';"); DB::statement("ALTER TABLE `incidents` CHANGE `component_id` `component_id` TINYINT(4) NOT NULL DEFAULT '1';");
}); });
} }
} }
@@ -2,7 +2,8 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
class CreateSessionTable extends Migration { class CreateSessionTable extends Migration
{
/** /**
* Run the migrations. * Run the migrations.
@@ -11,8 +12,7 @@ class CreateSessionTable extends Migration {
*/ */
public function up() public function up()
{ {
Schema::create('sessions', function($t) Schema::create('sessions', function ($t) {
{
$t->string('id')->unique(); $t->string('id')->unique();
$t->text('payload'); $t->text('payload');
$t->integer('last_activity'); $t->integer('last_activity');
@@ -28,5 +28,4 @@ class CreateSessionTable extends Migration {
{ {
Schema::drop('sessions'); Schema::drop('sessions');
} }
} }
@@ -1,16 +1,18 @@
<?php <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AlterTableComponentsAddDeletedAt extends Migration { class AlterTableComponentsAddDeletedAt extends Migration
{
/** /**
* Run the migrations. * Run the migrations.
* *
* @return void * @return void
*/ */
public function up() { public function up()
{
Schema::table('components', function (Blueprint $table) { Schema::table('components', function (Blueprint $table) {
$table->softDeletes(); $table->softDeletes();
}); });
@@ -24,5 +26,4 @@ class AlterTableComponentsAddDeletedAt extends Migration {
public function down() public function down()
{ {
} }
} }
+4 -3
View File
@@ -1,6 +1,7 @@
<?php <?php
class ComponentTableSeeder extends Seeder { class ComponentTableSeeder extends Seeder
{
/** /**
* Run the database seeds. * Run the database seeds.
@@ -16,7 +17,7 @@ class ComponentTableSeeder extends Seeder {
"name" => "API", "name" => "API",
"description" => "Used by third-parties to connect to us", "description" => "Used by third-parties to connect to us",
"status" => 1, "status" => 1,
"user_id" => 1 "user_id" => 1,
], [ ], [
"name" => "Payments", "name" => "Payments",
"description" => "Backed by Stripe", "description" => "Backed by Stripe",
@@ -26,7 +27,7 @@ class ComponentTableSeeder extends Seeder {
"name" => "Website", "name" => "Website",
"status" => 1, "status" => 1,
"user_id" => 1 "user_id" => 1
] ],
]; ];
Component::truncate(); Component::truncate();
+2 -2
View File
@@ -1,6 +1,7 @@
<?php <?php
class DatabaseSeeder extends Seeder { class DatabaseSeeder extends Seeder
{
/** /**
* Run the database seeds. * Run the database seeds.
@@ -15,5 +16,4 @@ class DatabaseSeeder extends Seeder {
$this->call('IncidentTableSeeder'); $this->call('IncidentTableSeeder');
$this->call('ComponentTableSeeder'); $this->call('ComponentTableSeeder');
} }
} }
+3 -2
View File
@@ -1,6 +1,7 @@
<?php <?php
class IncidentTableSeeder extends Seeder { class IncidentTableSeeder extends Seeder
{
/** /**
* Run the database seeds. * Run the database seeds.
@@ -38,7 +39,7 @@ class IncidentTableSeeder extends Seeder {
"status" => 4, "status" => 4,
"component_id" => 2, "component_id" => 2,
"user_id" => 1, "user_id" => 1,
] ],
]; ];
Incident::truncate(); Incident::truncate();
+4 -3
View File
@@ -1,6 +1,7 @@
<?php <?php
class SettingsTableSeeder extends Seeder { class SettingsTableSeeder extends Seeder
{
/** /**
* Run the database seeds. * Run the database seeds.
@@ -14,8 +15,8 @@ class SettingsTableSeeder extends Seeder {
$defaultSettings = [ $defaultSettings = [
[ [
"name" => "site_name", "name" => "site_name",
"value" => "Test" "value" => "Test",
] ],
]; ];
Setting::truncate(); Setting::truncate();
+1 -2
View File
@@ -26,7 +26,6 @@ Route::filter('auth', function() {
} }
}); });
Route::filter('auth.basic', function () { Route::filter('auth.basic', function () {
return Auth::basic(); return Auth::basic();
}); });
@@ -61,6 +60,6 @@ Route::filter('guest', function() {
Route::filter('csrf', function () { Route::filter('csrf', function () {
if (Session::token() !== Input::get('_token')) { if (Session::token() !== Input::get('_token')) {
throw new Illuminate\Session\TokenMismatchException; throw new Illuminate\Session\TokenMismatchException();
} }
}); });
+4 -2
View File
@@ -1,7 +1,9 @@
<?php <?php
class AllowedDomainsFilter { class AllowedDomainsFilter
public function filter($route, $request, $response) { {
public function filter($route, $request, $response)
{
// Always allow our own domain. // Always allow our own domain.
$ourDomain = Setting::get('app_domain'); $ourDomain = Setting::get('app_domain');
$response->headers->set('Access-Control-Allow-Origin', $ourDomain); $response->headers->set('Access-Control-Allow-Origin', $ourDomain);
+5 -2
View File
@@ -1,8 +1,11 @@
<?php <?php
class CORSFilter { class CORSFilter
public function filter($route, $request, $response) { {
public function filter($route, $request, $response)
{
$response->headers->set('Access-Control-Allow-Origin', '*'); $response->headers->set('Access-Control-Allow-Origin', '*');
return $response; return $response;
} }
} }
+4 -2
View File
@@ -1,7 +1,9 @@
<?php <?php
class HasSettingFilter { class HasSettingFilter
public function filter($route, $request, $settingName) { {
public function filter($route, $request, $settingName)
{
try { try {
$setting = Setting::where('name', $settingName)->first(); $setting = Setting::where('name', $settingName)->first();
if (!$setting->value) { if (!$setting->value) {
+4 -2
View File
@@ -1,7 +1,9 @@
<?php <?php
class IsSetupFilter { class IsSetupFilter
public function filter($route, $request) { {
public function filter($route, $request)
{
try { try {
$setting = Setting::where('name', 'app_name')->first(); $setting = Setting::where('name', 'app_name')->first();
if ($setting->value) { if ($setting->value) {
+3 -7
View File
@@ -1,7 +1,6 @@
<?php <?php
if ( ! function_exists('elixir')) if (! function_exists('elixir')) {
{
/** /**
* Get the path to a versioned Elixir file. * Get the path to a versioned Elixir file.
* *
@@ -12,17 +11,14 @@ if ( ! function_exists('elixir'))
{ {
static $manifest = null; static $manifest = null;
if (is_null($manifest)) if (is_null($manifest)) {
{
$manifest = json_decode(file_get_contents(public_path().'/build/rev-manifest.json'), true); $manifest = json_decode(file_get_contents(public_path().'/build/rev-manifest.json'), true);
} }
if (isset($manifest[$file])) if (isset($manifest[$file])) {
{
return '/build/'.$manifest[$file]; return '/build/'.$manifest[$file];
} }
throw new InvalidArgumentException("File {$file} not defined in asset manifest."); throw new InvalidArgumentException("File {$file} not defined in asset manifest.");
} }
} }
+16 -16
View File
@@ -1,35 +1,35 @@
<?php <?php
return array( return [
// Components // Components
'component' => array( 'component' => [
'status' => array( 'status' => [
1 => 'Operational', 1 => 'Operational',
2 => 'Performance Issues', 2 => 'Performance Issues',
3 => 'Partial Outage', 3 => 'Partial Outage',
4 => 'Major Outage' 4 => 'Major Outage',
) ],
), ],
// Incidents // Incidents
'incident' => array( 'incident' => [
'status' => array( 'status' => [
1 => 'Investigating', 1 => 'Investigating',
2 => 'Identified', 2 => 'Identified',
3 => 'Watching', 3 => 'Watching',
4 => 'Fixed' 4 => 'Fixed',
) ],
), ],
// Service Status // Service Status
'service' => array( 'service' => [
'good' => 'All systems are functional.', 'good' => 'All systems are functional.',
'bad' => 'Some systems are experiencing issues.', 'bad' => 'Some systems are experiencing issues.',
), ],
// Other // Other
'powered_by' => ':app Status Page is powered by <a href="https://cachethq.github.io">Cachet</a>.', 'powered_by' => ':app Status Page is powered by <a href="https://cachethq.github.io">Cachet</a>.',
'logout' => 'Logout', 'logout' => 'Logout',
'logged_in' => 'You\'re logged in.', 'logged_in' => 'You\'re logged in.',
'setup' => 'Setup Cachet', 'setup' => 'Setup Cachet',
'dashboard' => array( 'dashboard' => [
'dashboard' => 'Dashboard', 'dashboard' => 'Dashboard',
'components' => 'Components', 'components' => 'Components',
'component-add' => 'Add Component', 'component-add' => 'Add Component',
@@ -43,5 +43,5 @@ return array(
'notifications' => 'Notifications', 'notifications' => 'Notifications',
'toggle_navigation' => 'Toggle Navigation', 'toggle_navigation' => 'Toggle Navigation',
'search' => 'Search...', 'search' => 'Search...',
), ],
); ];
+2 -2
View File
@@ -1,6 +1,6 @@
<?php <?php
return array( return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -17,4 +17,4 @@ return array(
'next' => 'Next &raquo;', 'next' => 'Next &raquo;',
); ];
+2 -2
View File
@@ -1,6 +1,6 @@
<?php <?php
return array( return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -23,4 +23,4 @@ return array(
"reset" => "Password has been reset!", "reset" => "Password has been reset!",
); ];
+15 -15
View File
@@ -1,6 +1,6 @@
<?php <?php
return array( return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -21,12 +21,12 @@ return array(
"alpha_num" => "The :attribute may only contain letters and numbers.", "alpha_num" => "The :attribute may only contain letters and numbers.",
"array" => "The :attribute must be an array.", "array" => "The :attribute must be an array.",
"before" => "The :attribute must be a date before :date.", "before" => "The :attribute must be a date before :date.",
"between" => array( "between" => [
"numeric" => "The :attribute must be between :min and :max.", "numeric" => "The :attribute must be between :min and :max.",
"file" => "The :attribute must be between :min and :max kilobytes.", "file" => "The :attribute must be between :min and :max kilobytes.",
"string" => "The :attribute must be between :min and :max characters.", "string" => "The :attribute must be between :min and :max characters.",
"array" => "The :attribute must have between :min and :max items.", "array" => "The :attribute must have between :min and :max items.",
), ],
"boolean" => "The :attribute field must be true or false.", "boolean" => "The :attribute field must be true or false.",
"confirmed" => "The :attribute confirmation does not match.", "confirmed" => "The :attribute confirmation does not match.",
"date" => "The :attribute is not a valid date.", "date" => "The :attribute is not a valid date.",
@@ -40,19 +40,19 @@ return array(
"in" => "The selected :attribute is invalid.", "in" => "The selected :attribute is invalid.",
"integer" => "The :attribute must be an integer.", "integer" => "The :attribute must be an integer.",
"ip" => "The :attribute must be a valid IP address.", "ip" => "The :attribute must be a valid IP address.",
"max" => array( "max" => [
"numeric" => "The :attribute may not be greater than :max.", "numeric" => "The :attribute may not be greater than :max.",
"file" => "The :attribute may not be greater than :max kilobytes.", "file" => "The :attribute may not be greater than :max kilobytes.",
"string" => "The :attribute may not be greater than :max characters.", "string" => "The :attribute may not be greater than :max characters.",
"array" => "The :attribute may not have more than :max items.", "array" => "The :attribute may not have more than :max items.",
), ],
"mimes" => "The :attribute must be a file of type: :values.", "mimes" => "The :attribute must be a file of type: :values.",
"min" => array( "min" => [
"numeric" => "The :attribute must be at least :min.", "numeric" => "The :attribute must be at least :min.",
"file" => "The :attribute must be at least :min kilobytes.", "file" => "The :attribute must be at least :min kilobytes.",
"string" => "The :attribute must be at least :min characters.", "string" => "The :attribute must be at least :min characters.",
"array" => "The :attribute must have at least :min items.", "array" => "The :attribute must have at least :min items.",
), ],
"not_in" => "The selected :attribute is invalid.", "not_in" => "The selected :attribute is invalid.",
"numeric" => "The :attribute must be a number.", "numeric" => "The :attribute must be a number.",
"regex" => "The :attribute format is invalid.", "regex" => "The :attribute format is invalid.",
@@ -63,12 +63,12 @@ return array(
"required_without" => "The :attribute field is required when :values is not present.", "required_without" => "The :attribute field is required when :values is not present.",
"required_without_all" => "The :attribute field is required when none of :values are present.", "required_without_all" => "The :attribute field is required when none of :values are present.",
"same" => "The :attribute and :other must match.", "same" => "The :attribute and :other must match.",
"size" => array( "size" => [
"numeric" => "The :attribute must be :size.", "numeric" => "The :attribute must be :size.",
"file" => "The :attribute must be :size kilobytes.", "file" => "The :attribute must be :size kilobytes.",
"string" => "The :attribute must be :size characters.", "string" => "The :attribute must be :size characters.",
"array" => "The :attribute must contain :size items.", "array" => "The :attribute must contain :size items.",
), ],
"unique" => "The :attribute has already been taken.", "unique" => "The :attribute has already been taken.",
"url" => "The :attribute format is invalid.", "url" => "The :attribute format is invalid.",
"timezone" => "The :attribute must be a valid zone.", "timezone" => "The :attribute must be a valid zone.",
@@ -84,11 +84,11 @@ return array(
| |
*/ */
'custom' => array( 'custom' => [
'attribute-name' => array( 'attribute-name' => [
'rule-name' => 'custom-message', 'rule-name' => 'custom-message',
), ],
), ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -101,6 +101,6 @@ return array(
| |
*/ */
'attributes' => array(), 'attributes' => [],
); ];
+9 -5
View File
@@ -2,14 +2,15 @@
use Watson\Validating\ValidatingTrait; use Watson\Validating\ValidatingTrait;
class Component extends Eloquent implements \Dingo\Api\Transformer\TransformableInterface { class Component extends Eloquent implements \Dingo\Api\Transformer\TransformableInterface
{
use ValidatingTrait; use ValidatingTrait;
use Illuminate\Database\Eloquent\SoftDeletingTrait; use Illuminate\Database\Eloquent\SoftDeletingTrait;
protected $rules = [ protected $rules = [
'user_id' => 'integer|required', 'user_id' => 'integer|required',
'name' => 'required', 'name' => 'required',
'status' => 'integer' 'status' => 'integer',
]; ];
protected $fillable = ['name', 'description', 'status', 'user_id']; protected $fillable = ['name', 'description', 'status', 'user_id'];
@@ -18,7 +19,8 @@ class Component extends Eloquent implements \Dingo\Api\Transformer\Transformable
* Lookup all of the incidents reported on the component. * Lookup all of the incidents reported on the component.
* @return Illuminate\Database\Eloquent\Relations * @return Illuminate\Database\Eloquent\Relations
*/ */
public function incidents() { public function incidents()
{
return $this->hasMany('Incident', 'component_id', 'id'); return $this->hasMany('Incident', 'component_id', 'id');
} }
@@ -26,7 +28,8 @@ class Component extends Eloquent implements \Dingo\Api\Transformer\Transformable
* Looks up the human readable version of the status. * Looks up the human readable version of the status.
* @return string * @return string
*/ */
public function getHumanStatusAttribute() { public function getHumanStatusAttribute()
{
return Lang::get('cachet.component.status.'.$this->status); return Lang::get('cachet.component.status.'.$this->status);
} }
@@ -34,7 +37,8 @@ class Component extends Eloquent implements \Dingo\Api\Transformer\Transformable
* Get the transformer instance. * Get the transformer instance.
* @return ComponentTransformer * @return ComponentTransformer
*/ */
public function getTransformer() { public function getTransformer()
{
return new CachetHQ\Cachet\Transformers\ComponentTransformer(); return new CachetHQ\Cachet\Transformers\ComponentTransformer();
} }
} }
+11 -5
View File
@@ -2,7 +2,8 @@
use Watson\Validating\ValidatingTrait; use Watson\Validating\ValidatingTrait;
class Incident extends Eloquent implements \Dingo\Api\Transformer\TransformableInterface { class Incident extends Eloquent implements \Dingo\Api\Transformer\TransformableInterface
{
use ValidatingTrait; use ValidatingTrait;
use Illuminate\Database\Eloquent\SoftDeletingTrait; use Illuminate\Database\Eloquent\SoftDeletingTrait;
@@ -22,7 +23,8 @@ class Incident extends Eloquent implements \Dingo\Api\Transformer\TransformableI
* An incident belongs to a component. * An incident belongs to a component.
* @return Illuminate\Database\Eloquent\Relations\BelongsTo * @return Illuminate\Database\Eloquent\Relations\BelongsTo
*/ */
public function component() { public function component()
{
return $this->belongsTo('Component', 'component_id', 'id'); return $this->belongsTo('Component', 'component_id', 'id');
} }
@@ -30,8 +32,10 @@ class Incident extends Eloquent implements \Dingo\Api\Transformer\TransformableI
* Returns a human readable version of the status. * Returns a human readable version of the status.
* @return string * @return string
*/ */
public function getHumanStatusAttribute() { public function getHumanStatusAttribute()
{
$statuses = Lang::get('cachet.incident.status'); $statuses = Lang::get('cachet.incident.status');
return $statuses[$this->status]; return $statuses[$this->status];
} }
@@ -39,7 +43,8 @@ class Incident extends Eloquent implements \Dingo\Api\Transformer\TransformableI
* Finds the icon to use for each status. * Finds the icon to use for each status.
* @return string * @return string
*/ */
public function getIconAttribute() { public function getIconAttribute()
{
switch ($this->status) { switch ($this->status) {
case 1: return 'fa fa-flag'; case 1: return 'fa fa-flag';
case 2: return 'fa fa-warning'; case 2: return 'fa fa-warning';
@@ -52,7 +57,8 @@ class Incident extends Eloquent implements \Dingo\Api\Transformer\TransformableI
* Get the transformer instance. * Get the transformer instance.
* @return CachetHQ\Cachet\Transformers\IncidentTransformer * @return CachetHQ\Cachet\Transformers\IncidentTransformer
*/ */
public function getTransformer() { public function getTransformer()
{
return new CachetHQ\Cachet\Transformers\IncidentTransformer(); return new CachetHQ\Cachet\Transformers\IncidentTransformer();
} }
} }
+4 -2
View File
@@ -2,7 +2,8 @@
use Watson\Validating\ValidatingTrait; use Watson\Validating\ValidatingTrait;
class IncidentTemplate extends Eloquent { class IncidentTemplate extends Eloquent
{
use ValidatingTrait; use ValidatingTrait;
protected $rules = [ protected $rules = [
@@ -19,7 +20,8 @@ class IncidentTemplate extends Eloquent {
* Overrides the models boot method. * Overrides the models boot method.
* @return void * @return void
*/ */
public static function boot() { public static function boot()
{
parent::boot(); parent::boot();
self::saving(function ($template) { self::saving(function ($template) {
+8 -4
View File
@@ -2,7 +2,8 @@
use Watson\Validating\ValidatingTrait; use Watson\Validating\ValidatingTrait;
class Metric extends Eloquent implements \Dingo\Api\Transformer\TransformableInterface { class Metric extends Eloquent implements \Dingo\Api\Transformer\TransformableInterface
{
use ValidatingTrait; use ValidatingTrait;
protected $rules = [ protected $rules = [
@@ -17,7 +18,8 @@ class Metric extends Eloquent implements \Dingo\Api\Transformer\TransformableInt
* Metrics contain many metric points. * Metrics contain many metric points.
* @return Illuminate\Database\Eloquent\Builder * @return Illuminate\Database\Eloquent\Builder
*/ */
public function points() { public function points()
{
return $this->hasMany('MetricPoint', 'metric_id', 'id'); return $this->hasMany('MetricPoint', 'metric_id', 'id');
} }
@@ -25,7 +27,8 @@ class Metric extends Eloquent implements \Dingo\Api\Transformer\TransformableInt
* Determines whether a chart should be shown. * Determines whether a chart should be shown.
* @return bool * @return bool
*/ */
public function getShouldDisplayAttribute() { public function getShouldDisplayAttribute()
{
return $this->display_chart === 1; return $this->display_chart === 1;
} }
@@ -33,7 +36,8 @@ class Metric extends Eloquent implements \Dingo\Api\Transformer\TransformableInt
* Get the transformer instance. * Get the transformer instance.
* @return CachetHQ\Cachet\Transformers\MetricTransformer * @return CachetHQ\Cachet\Transformers\MetricTransformer
*/ */
public function getTransformer() { public function getTransformer()
{
return new CachetHQ\Cachet\Transformers\MetricTransformer(); return new CachetHQ\Cachet\Transformers\MetricTransformer();
} }
} }
+4 -2
View File
@@ -1,11 +1,13 @@
<?php <?php
class MetricPoint extends Eloquent { class MetricPoint extends Eloquent
{
/** /**
* A metric point belongs to a metric unit. * A metric point belongs to a metric unit.
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/ */
public function metric() { public function metric()
{
return $this->belongsTo('Metric', 'id', 'metric_id'); return $this->belongsTo('Metric', 'id', 'metric_id');
} }
} }
+7 -4
View File
@@ -2,13 +2,14 @@
use Watson\Validating\ValidatingTrait; use Watson\Validating\ValidatingTrait;
class Service extends Eloquent { class Service extends Eloquent
{
use ValidatingTrait; use ValidatingTrait;
protected $rules = [ protected $rules = [
'type' => 'alpha_dash|required', 'type' => 'alpha_dash|required',
'active' => 'required|in:0,1', 'active' => 'required|in:0,1',
'properties' => '' 'properties' => '',
]; ];
/** /**
@@ -16,7 +17,8 @@ class Service extends Eloquent {
* @param string $properties * @param string $properties
* @return object * @return object
*/ */
public function getPropertiesAttribute($properties) { public function getPropertiesAttribute($properties)
{
return json_decode($properties); return json_decode($properties);
} }
@@ -24,7 +26,8 @@ class Service extends Eloquent {
* Sets the properties attribute which auto encodes to a JSON string. * Sets the properties attribute which auto encodes to a JSON string.
* @param mixed $properties * @param mixed $properties
*/ */
public function setPropertiesAttribute($properties) { public function setPropertiesAttribute($properties)
{
$this->attributes['properties'] = json_encode($properties); $this->attributes['properties'] = json_encode($properties);
} }
} }
+6 -3
View File
@@ -1,6 +1,7 @@
<?php <?php
class Setting extends Eloquent { class Setting extends Eloquent
{
protected $fillable = ['name', 'value']; protected $fillable = ['name', 'value'];
/** /**
@@ -9,7 +10,8 @@ class Setting extends Eloquent {
* @param bool $checkEnv * @param bool $checkEnv
* @return string * @return string
*/ */
public static function get($settingName, $checkEnv = true) { public static function get($settingName, $checkEnv = true)
{
// Default setting value. // Default setting value.
$setting = null; $setting = null;
@@ -36,7 +38,8 @@ class Setting extends Eloquent {
* @throws Exception * @throws Exception
* @return void * @return void
*/ */
public static function unknownSettingException($setting) { public static function unknownSettingException($setting)
{
throw new \Exception( throw new \Exception(
sprintf('Unknown setting %s', $setting) sprintf('Unknown setting %s', $setting)
); );
+4 -3
View File
@@ -1,14 +1,15 @@
<?php <?php
use Watson\Validating\ValidatingTrait;
use Illuminate\Database\Eloquent\SoftDeletingTrait; use Illuminate\Database\Eloquent\SoftDeletingTrait;
use Watson\Validating\ValidatingTrait;
class Subscriber extends Eloquent { class Subscriber extends Eloquent
{
use ValidatingTrait; use ValidatingTrait;
use SoftDeletingTrait; use SoftDeletingTrait;
protected $rules = [ protected $rules = [
'email' => 'required|email' 'email' => 'required|email',
]; ];
protected $fillable = ['email']; protected $fillable = ['email'];
+9 -7
View File
@@ -1,11 +1,12 @@
<?php <?php
use Illuminate\Auth\UserTrait;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableTrait;
use Illuminate\Auth\Reminders\RemindableInterface; use Illuminate\Auth\Reminders\RemindableInterface;
use Illuminate\Auth\Reminders\RemindableTrait;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\UserTrait;
class User extends Eloquent implements UserInterface, RemindableInterface { class User extends Eloquent implements UserInterface, RemindableInterface
{
use UserTrait, RemindableTrait; use UserTrait, RemindableTrait;
/** /**
@@ -32,7 +33,8 @@ class User extends Eloquent implements UserInterface, RemindableInterface {
* @param string @password * @param string @password
* @return void * @return void
*/ */
public function setPasswordAttribute($password) { public function setPasswordAttribute($password)
{
$this->attributes['password'] = Hash::make($password); $this->attributes['password'] = Hash::make($password);
} }
@@ -41,12 +43,12 @@ class User extends Eloquent implements UserInterface, RemindableInterface {
* @param integer $size * @param integer $size
* @return string * @return string
*/ */
public function getGravatarAttribute($size = 200) { public function getGravatarAttribute($size = 200)
{
return sprintf( return sprintf(
'https://www.gravatar.com/avatar/%s?size=%d', 'https://www.gravatar.com/avatar/%s?size=%d',
md5($this->email), md5($this->email),
$size $size
); );
} }
} }
+15 -9
View File
@@ -1,6 +1,7 @@
<?php <?php
class WebHook extends Eloquent { class WebHook extends Eloquent
{
// Request Methods. // Request Methods.
const HEAD = 0; const HEAD = 0;
const GET = 1; const GET = 1;
@@ -13,7 +14,8 @@ class WebHook extends Eloquent {
* Returns all responses for a WebHook. * Returns all responses for a WebHook.
* @return Illuminate\Database\Eloquent\Builder * @return Illuminate\Database\Eloquent\Builder
*/ */
public function response() { public function response()
{
return $this->hasMany('WebHookContent', 'hook_id', 'id'); return $this->hasMany('WebHookContent', 'hook_id', 'id');
} }
@@ -22,7 +24,8 @@ class WebHook extends Eloquent {
* @param Illuminate\Database\Eloquent\Builder $query * @param Illuminate\Database\Eloquent\Builder $query
* @return Illuminate\Database\Eloquent\Builder * @return Illuminate\Database\Eloquent\Builder
*/ */
public function scopeActive($query) { public function scopeActive($query)
{
return $query->where('active', 1); return $query->where('active', 1);
} }
@@ -30,7 +33,8 @@ class WebHook extends Eloquent {
* Setups a Ping event that is fired upon a web hook. * Setups a Ping event that is fired upon a web hook.
* @return array result of the ping * @return array result of the ping
*/ */
public function ping() { public function ping()
{
return $this->fire('ping', 'Coming live to you from Cachet.'); return $this->fire('ping', 'Coming live to you from Cachet.');
} }
@@ -40,7 +44,8 @@ class WebHook extends Eloquent {
* @param mixed $data Data to send to the Web Hook * @param mixed $data Data to send to the Web Hook
* @return object * @return object
*/ */
public function fire($eventType, $data = null) { public function fire($eventType, $data = null)
{
$startTime = microtime(true); $startTime = microtime(true);
$client = new \GuzzleHttp\Client(); $client = new \GuzzleHttp\Client();
@@ -58,10 +63,10 @@ class WebHook extends Eloquent {
$response = $e->getResponse(); $response = $e->getResponse();
} }
$timeTaken = microtime(TRUE) - $startTime; $timeTaken = microtime(true) - $startTime;
// Store the request // Store the request
$hookResponse = new WebHookResponse; $hookResponse = new WebHookResponse();
$hookResponse->web_hook_id = $this->id; $hookResponse->web_hook_id = $this->id;
$hookResponse->response_code = $response->getStatusCode(); $hookResponse->response_code = $response->getStatusCode();
$hookResponse->sent_headers = json_encode($request->getHeaders()); $hookResponse->sent_headers = json_encode($request->getHeaders());
@@ -79,8 +84,9 @@ class WebHook extends Eloquent {
* @throws Exception * @throws Exception
* @return string HEAD, GET, POST, DELETE, PATCH, PUT etc * @return string HEAD, GET, POST, DELETE, PATCH, PUT etc
*/ */
public function getRequestMethodAttribute() { public function getRequestMethodAttribute()
$requestMethod = NULL; {
$requestMethod = null;
switch ($this->request_type) { switch ($this->request_type) {
case self::HEAD: case self::HEAD:
+4 -2
View File
@@ -1,11 +1,13 @@
<?php <?php
class WebHookResponse extends Eloquent { class WebHookResponse extends Eloquent
{
/** /**
* Returns the hook that a response belongs to. * Returns the hook that a response belongs to.
* @return Illuminate\Database\Eloquent\Relations\BelongsTo * @return Illuminate\Database\Eloquent\Relations\BelongsTo
*/ */
public function hook() { public function hook()
{
return $this->belongsTo('WebHook', 'id', 'hook_id'); return $this->belongsTo('WebHook', 'id', 'hook_id');
} }
} }
+1 -1
View File
@@ -3,7 +3,7 @@
Route::api([ Route::api([
'version' => 'v1', 'version' => 'v1',
'namespace' => 'CachetHQ\Cachet\Controllers\Api', 'namespace' => 'CachetHQ\Cachet\Controllers\Api',
'after' => 'allowed_domains' 'after' => 'allowed_domains',
], function () { ], function () {
Route::get('components', 'ComponentController@getComponents'); Route::get('components', 'ComponentController@getComponents');
Route::get('components/{id}', 'ComponentController@getComponent'); Route::get('components/{id}', 'ComponentController@getComponent');
-1
View File
@@ -10,4 +10,3 @@
| the console gets access to each of the command object instances. | the console gets access to each of the command object instances.
| |
*/ */
+5 -7
View File
@@ -11,7 +11,7 @@
| |
*/ */
ClassLoader::addDirectories(array( ClassLoader::addDirectories([
app_path().'/commands', app_path().'/commands',
app_path().'/controllers', app_path().'/controllers',
@@ -20,7 +20,7 @@ ClassLoader::addDirectories(array(
app_path().'/database/seeds', app_path().'/database/seeds',
app_path().'/filters', app_path().'/filters',
)); ]);
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -48,8 +48,7 @@ Log::useFiles(storage_path().'/logs/laravel.log');
| |
*/ */
App::error(function(Exception $exception, $code) App::error(function (Exception $exception, $code) {
{
Log::error($exception); Log::error($exception);
}); });
@@ -58,7 +57,7 @@ API::error(function (\Illuminate\Database\Eloquent\ModelNotFoundException $excep
}); });
App::missing(function ($exception) { App::missing(function ($exception) {
return Response::view('errors.404', array(), 404); return Response::view('errors.404', [], 404);
}); });
/* /*
@@ -72,8 +71,7 @@ App::missing(function($exception) {
| |
*/ */
App::down(function() App::down(function () {
{
return Response::make("Be right back!", 503); return Response::make("Be right back!", 503);
}); });
@@ -1,17 +1,21 @@
<?php <?php
class ComponentControllerTest extends TestCase { class ComponentControllerTest extends TestCase
{
public function setUp() { public function setUp()
{
$this->repo = Mockery::mock('CachetHQ\Cachet\Repositories\Component\ComponentRepository'); $this->repo = Mockery::mock('CachetHQ\Cachet\Repositories\Component\ComponentRepository');
$this->dingo = Mockery::mock('Dingo\Api\Auth\Shield'); $this->dingo = Mockery::mock('Dingo\Api\Auth\Shield');
} }
public function tearDown() { public function tearDown()
{
Mockery::close(); Mockery::close();
} }
public function test_get_components_method() { public function test_get_components_method()
{
$this->repo->shouldReceive('all')->once()->andReturn('foo'); $this->repo->shouldReceive('all')->once()->andReturn('foo');
$controller = new CachetHQ\Cachet\Controllers\Api\ComponentController($this->repo); $controller = new CachetHQ\Cachet\Controllers\Api\ComponentController($this->repo);
@@ -20,7 +24,8 @@ class ComponentControllerTest extends TestCase {
$this->assertEquals('foo', $response); $this->assertEquals('foo', $response);
} }
public function test_get_component_method() { public function test_get_component_method()
{
$this->repo->shouldReceive('findOrFail')->with(1)->once()->andReturn('foo'); $this->repo->shouldReceive('findOrFail')->with(1)->once()->andReturn('foo');
$controller = new CachetHQ\Cachet\Controllers\Api\ComponentController($this->repo); $controller = new CachetHQ\Cachet\Controllers\Api\ComponentController($this->repo);
@@ -28,5 +33,4 @@ class ComponentControllerTest extends TestCase {
$this->assertEquals('foo', $response); $this->assertEquals('foo', $response);
} }
} }
+2 -1
View File
@@ -1,6 +1,7 @@
<?php <?php
class TestCase extends Illuminate\Foundation\Testing\TestCase { class TestCase extends Illuminate\Foundation\Testing\TestCase
{
/** /**
* Creates the application. * Creates the application.
+1 -1
View File
@@ -19,6 +19,6 @@ View::composer('index', function($view) {
$view->with([ $view->with([
'systemStatus' => $status, 'systemStatus' => $status,
'systemMessage' => $message 'systemMessage' => $message,
]); ]);
}); });
+2 -4
View File
@@ -27,8 +27,7 @@ require __DIR__.'/../vendor/autoload.php';
| |
*/ */
if (file_exists($compiled = __DIR__.'/compiled.php')) if (file_exists($compiled = __DIR__.'/compiled.php')) {
{
require $compiled; require $compiled;
} }
@@ -69,7 +68,6 @@ Illuminate\Support\ClassLoader::register();
| |
*/ */
if (is_dir($workbench = __DIR__.'/../workbench')) if (is_dir($workbench = __DIR__.'/../workbench')) {
{
Illuminate\Workbench\Starter::start($workbench); Illuminate\Workbench\Starter::start($workbench);
} }
+2 -2
View File
@@ -1,6 +1,6 @@
<?php <?php
return array( return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -54,4 +54,4 @@ return array(
'storage' => __DIR__.'/../app/storage', 'storage' => __DIR__.'/../app/storage',
); ];
+1 -1
View File
@@ -11,7 +11,7 @@
| |
*/ */
$app = new Illuminate\Foundation\Application; $app = new Illuminate\Foundation\Application();
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
+1 -2
View File
@@ -11,8 +11,7 @@ $requested = $paths['public'].$uri;
// This file allows us to emulate Apache's "mod_rewrite" functionality from the // This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel // built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here. // application without having installed a "real" web server software here.
if ($uri !== '/' and file_exists($requested)) if ($uri !== '/' and file_exists($requested)) {
{
return false; return false;
} }