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

View File

@ -2,56 +2,62 @@
namespace CachetHQ\Cachet\Controllers\Api;
use Input;
use CachetHQ\Cachet\Repositories\Component\ComponentRepository;
use Dingo\Api\Routing\ControllerTrait;
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) {
$this->component = $component;
}
public function __construct(ComponentRepository $component)
{
$this->component = $component;
}
/**
* Get all components
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public function getComponents() {
return $this->component->all();
}
/**
* Get all components
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public function getComponents()
{
return $this->component->all();
}
/**
* Get a single component
*
* @param int $id
*
* @return \Component
*/
public function getComponent($id) {
return $this->component->findOrFail($id);
}
/**
* Get a single component
*
* @param int $id
*
* @return \Component
*/
public function getComponent($id)
{
return $this->component->findOrFail($id);
}
/**
* Return a component with incidents
* @param int $id Component ID
* @return \Component
*/
public function getComponentIncidents($id) {
return $this->component->with($id, ['incidents']);
}
/**
* Return a component with incidents
* @param int $id Component ID
* @return \Component
*/
public function getComponentIncidents($id)
{
return $this->component->with($id, ['incidents']);
}
/**
* Create a new component
*
* @return \Component
*/
public function postComponents() {
return $this->component->create($this->auth->user()->id, Input::all());
}
/**
* Create a new component
*
* @return \Component
*/
public function postComponents()
{
return $this->component->create($this->auth->user()->id, Input::all());
}
}

View File

@ -2,18 +2,20 @@
namespace CachetHQ\Cachet\Controllers\Api;
use Input;
use CachetHQ\Cachet\Repositories\Incident\IncidentRepository;
use Dingo\Api\Routing\ControllerTrait;
use Illuminate\Routing\Controller;
use CachetHQ\Cachet\Repositories\Incident\IncidentRepository;
use Input;
class IncidentController extends Controller {
class IncidentController extends Controller
{
use ControllerTrait;
protected $incident;
public function __construct(IncidentRepository $incident) {
public function __construct(IncidentRepository $incident)
{
$this->incident = $incident;
}
@ -22,7 +24,8 @@ class IncidentController extends Controller {
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public function getIncidents() {
public function getIncidents()
{
return $this->incident->all();
}
@ -33,7 +36,8 @@ class IncidentController extends Controller {
*
* @return Incident
*/
public function getIncident($id) {
public function getIncident($id)
{
return $this->incident->findOrFail($id);
}
@ -42,7 +46,8 @@ class IncidentController extends Controller {
*
* @return Incident
*/
public function postIncidents() {
public function postIncidents()
{
return $this->incident->create($this->auth->user()->id, Input::all());
}
@ -53,7 +58,8 @@ class IncidentController extends Controller {
*
* @return Incident
*/
public function putIncident($id) {
public function putIncident($id)
{
return $this->incident->update($id, Input::all());
}
}

View File

@ -2,18 +2,20 @@
namespace CachetHQ\Cachet\Controllers\Api;
use Input;
use CachetHQ\Cachet\Repositories\Metric\MetricRepository;
use Dingo\Api\Routing\ControllerTrait;
use Illuminate\Routing\Controller;
use CachetHQ\Cachet\Repositories\Metric\MetricRepository;
use Input;
class MetricController extends Controller {
class MetricController extends Controller
{
use ControllerTrait;
protected $metric;
public function __construct(MetricRepository $metric) {
public function __construct(MetricRepository $metric)
{
$this->metric = $metric;
}
/**
@ -21,7 +23,8 @@ class MetricController extends Controller {
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public function getMetrics() {
public function getMetrics()
{
return $this->metric->all();
}
@ -32,7 +35,8 @@ class MetricController extends Controller {
*
* @return Metric
*/
public function getMetric($id) {
public function getMetric($id)
{
return $this->metric->findOrFail($id);
}
@ -41,7 +45,8 @@ class MetricController extends Controller {
*
* @return Metric
*/
public function postMetrics() {
public function postMetrics()
{
return $this->metric->create(Input::all());
}
@ -52,7 +57,8 @@ class MetricController extends Controller {
*
* @return Metric
*/
public function putMetric($id) {
public function putMetric($id)
{
return $this->metric->update($id, Input::all());
}
}

View File

@ -2,18 +2,20 @@
namespace CachetHQ\Cachet\Controllers\Api;
use Input;
use CachetHQ\Cachet\Repositories\MetricPoint\MetricPointRepository;
use Dingo\Api\Routing\ControllerTrait;
use Illuminate\Routing\Controller;
use CachetHQ\Cachet\Repositories\MetricPoint\MetricPointRepository;
use Input;
class MetricController extends Controller {
class MetricPointController extends Controller
{
use ControllerTrait;
protected $metricpoint;
public function __construct(MetricPointRepository $metricpoint) {
public function __construct(MetricPointRepository $metricpoint)
{
$this->metricpoint = $metricpoint;
}
/**
@ -21,7 +23,8 @@ class MetricController extends Controller {
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public function getMetricPoints() {
public function getMetricPoints()
{
return $this->metricpoint->all();
}
@ -32,7 +35,8 @@ class MetricController extends Controller {
*
* @return MetricPoint
*/
public function getMetricPoint($id) {
public function getMetricPoint($id)
{
return $this->metricpoint->findOrFail($id);
}
@ -41,7 +45,8 @@ class MetricController extends Controller {
*
* @return MetricPoint
*/
public function postMetricPoints() {
public function postMetricPoints()
{
return $this->metricpoint->create(Input::all());
}
}

View File

@ -2,13 +2,14 @@
namespace CachetHQ\Cachet\Repositories\Component;
interface ComponentRepository {
interface ComponentRepository
{
public function all();
public function all();
public function create($id, array $array);
public function create($id, array $array);
public function findOrFail($id);
public function findOrFail($id);
public function with($id, array $with);
public function with($id, array $with);
}

View File

@ -4,23 +4,26 @@ namespace CachetHQ\Cachet\Repositories\Component;
use CachetHQ\Cachet\Repositories\EloquentRepository;
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) {
$this->model = $model;
}
public function __construct(Component $model)
{
$this->model = $model;
}
public function create($user_id, array $array) {
$component = new $this->model($array);
$component->user_id = $user_id;
public function create($user_id, array $array)
{
$component = new $this->model($array);
$component->user_id = $user_id;
$this->validate($component);
$this->validate($component);
$component->saveOrFail();
return $component;
}
$component->saveOrFail();
return $component;
}
}

View File

@ -2,119 +2,131 @@
namespace CachetHQ\Cachet\Repositories;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Exception;
use Illuminate\Database\Eloquent\ModelNotFoundException;
abstract class EloquentRepository {
abstract class EloquentRepository
{
/**
* Returns all models
* @return object
*/
public function all() {
return $this->model->all();
}
/**
* Returns all models
* @return object
*/
public function all()
{
return $this->model->all();
}
/**
* Returns an object with related relationships
* @param id $id
* @param array $with Array of model relationships
* @return object|ModelNotFoundException
*/
public function with($id, array $with = []) {
return $this->model->with($with)->findOrFail($id);
}
/**
* Returns an object with related relationships
* @param id $id
* @param array $with Array of model relationships
* @return object|ModelNotFoundException
*/
public function with($id, array $with = [])
{
return $this->model->with($with)->findOrFail($id);
}
/**
* Sets the model to query against a user id
* @param integer $id
* @param string $column
* @return $this
*/
public function withAuth($id, $column = 'user_id') {
$this->model = $this->model->where($column, $id);
return $this;
}
/**
* Sets the model to query against a user id
* @param integer $id
* @param string $column
* @return $this
*/
public function withAuth($id, $column = 'user_id')
{
$this->model = $this->model->where($column, $id);
/**
* Finds a model by ID
* @param int $id
* @return object
*/
public function find(int $id) {
return $this->model->find($id);
}
return $this;
}
/**
* Finds a model by ID
* @param integer $id
* @return object|ModelNotFoundException
*/
public function findOrFail($id) {
return $this->model->findOrFail($id);
}
/**
* Finds a model by ID
* @param int $id
* @return object
*/
public function find(int $id)
{
return $this->model->find($id);
}
/**
* Finds a model by type
* @param string $key
* @param string $value
* @param array $columns
* @return object|ModelNotFoundException
*/
public function findByOrFail($key, $value, $columns = ['*']) {
if (! is_null($item = $this->model->where($key, $value)->first($columns))) {
return $item;
}
/**
* Finds a model by ID
* @param integer $id
* @return object|ModelNotFoundException
*/
public function findOrFail($id)
{
return $this->model->findOrFail($id);
}
throw new ModelNotFoundException;
}
/**
* Finds a model by type
* @param string $key
* @param string $value
* @param array $columns
* @return object|ModelNotFoundException
*/
public function findByOrFail($key, $value, $columns = ['*'])
{
if (! is_null($item = $this->model->where($key, $value)->first($columns))) {
return $item;
}
/**
* Counts the number of rows returned
* @param string $key
* @param string $value
* @return integer
*/
public function count($key = null, $value = null) {
if (is_null($key) || is_null($value)) {
return $this->model->where($key, $value)->count();
}
throw new ModelNotFoundException();
}
return $this->model->count();
}
/**
* Counts the number of rows returned
* @param string $key
* @param string $value
* @return integer
*/
public function count($key = null, $value = null)
{
if (is_null($key) || is_null($value)) {
return $this->model->where($key, $value)->count();
}
/**
* Deletes a model by ID
* @param inetegr $id
*/
public function destroy($id) {
$this->model->delete($id);
}
return $this->model->count();
}
/**
* Validate a given model with Watson validation
* @param object $model
* @return Exception
*/
public function validate($model) {
if ($model->isInvalid()) {
throw new Exception('Invalid model validation');
}
/**
* Deletes a model by ID
* @param inetegr $id
*/
public function destroy($id)
{
$this->model->delete($id);
}
return $this;
}
/**
* Validate a given model with Watson validation
* @param object $model
* @return Exception
*/
public function validate($model)
{
if ($model->isInvalid()) {
throw new Exception('Invalid model validation');
}
/**
* Validate whether a model has a correct relationship
* @param object $model
* @param string $relationship Name of the relationship to validate against
* @return Exception
*/
public function hasRelationship($model, $relationship) {
if (! $model->$relationship) {
throw new Exception('Invalid relationship exception');
}
return $this;
}
return $this;
}
/**
* Validate whether a model has a correct relationship
* @param object $model
* @param string $relationship Name of the relationship to validate against
* @return Exception
*/
public function hasRelationship($model, $relationship)
{
if (! $model->$relationship) {
throw new Exception('Invalid relationship exception');
}
return $this;
}
}

View File

@ -5,31 +5,37 @@ namespace CachetHQ\Cachet\Repositories\Incident;
use CachetHQ\Cachet\Repositories\EloquentRepository;
use Incident;
class EloquentIncidentRepository extends EloquentRepository implements IncidentRepository {
class EloquentIncidentRepository extends EloquentRepository implements IncidentRepository
{
protected $model;
protected $model;
public function __construct(Incident $model) {
$this->model = $model;
}
public function __construct(Incident $model)
{
$this->model = $model;
}
public function create($user_id, array $array) {
$incident = new $this->model($array);
$incident->user_id = $user_id;
public function create($user_id, array $array)
{
$incident = new $this->model($array);
$incident->user_id = $user_id;
$this->validate($incident)->hasRelationship($incident, 'component');
$this->validate($incident)->hasRelationship($incident, 'component');
$incident->saveOrFail();
return $incident;
}
$incident->saveOrFail();
public function update($id, array $array) {
$incident = $this->model->findOrFail($id);
$incident->fill($array);
return $incident;
}
$this->validate($incident)->hasRelationship($incident, 'component');
public function update($id, array $array)
{
$incident = $this->model->findOrFail($id);
$incident->fill($array);
$incident->update($array);
return $incident;
}
$this->validate($incident)->hasRelationship($incident, 'component');
$incident->update($array);
return $incident;
}
}

View File

@ -2,13 +2,14 @@
namespace CachetHQ\Cachet\Repositories\Incident;
interface IncidentRepository {
interface IncidentRepository
{
public function all();
public function all();
public function create($id, array $array);
public function create($id, array $array);
public function findOrFail($id);
public function findOrFail($id);
public function update($id, array $with);
public function update($id, array $with);
}

View File

@ -5,30 +5,36 @@ namespace CachetHQ\Cachet\Repositories\Metric;
use CachetHQ\Cachet\Repositories\EloquentRepository;
use Metric;
class EloquentMetricRepository extends EloquentRepository implements MetricRepository {
class EloquentMetricRepository extends EloquentRepository implements MetricRepository
{
protected $model;
protected $model;
public function __construct(Metric $model) {
$this->model = $model;
}
public function __construct(Metric $model)
{
$this->model = $model;
}
public function create(array $array) {
$metric = new $this->model($array);
public function create(array $array)
{
$metric = new $this->model($array);
$this->validate($metric);
$this->validate($metric);
$metric->saveOrFail();
return $metric;
}
$metric->saveOrFail();
public function update($id, array $array) {
$metric = $this->model->findOrFail($id);
$metric->fill($array);
return $metric;
}
$this->validate($metric);
public function update($id, array $array)
{
$metric = $this->model->findOrFail($id);
$metric->fill($array);
$metric->update($array);
return $metric;
}
$this->validate($metric);
$metric->update($array);
return $metric;
}
}

View File

@ -2,13 +2,14 @@
namespace CachetHQ\Cachet\Repositories\Metric;
interface MetricRepository {
interface MetricRepository
{
public function all();
public function all();
public function create(array $array);
public function create(array $array);
public function findOrFail($id);
public function findOrFail($id);
public function update($id, array $with);
public function update($id, array $with);
}

View File

@ -5,30 +5,36 @@ namespace CachetHQ\Cachet\Repositories\MetricPoint;
use CachetHQ\Cachet\Repositories\EloquentRepository;
use MetricPoint;
class EloquentMetricRepository extends EloquentRepository implements MetricRepository {
class EloquentMetricPointRepository extends EloquentRepository implements MetricRepository
{
protected $model;
protected $model;
public function __construct(MetricPoint $model) {
$this->model = $model;
}
public function __construct(MetricPoint $model)
{
$this->model = $model;
}
public function create(array $array) {
$metric = new $this->model($array);
public function create(array $array)
{
$metric = new $this->model($array);
$this->validate($metric);
$this->validate($metric);
$metric->saveOrFail();
return $metric;
}
$metric->saveOrFail();
public function update($id, array $array) {
$metric = $this->model->findOrFail($id);
$metric->fill($array);
return $metric;
}
$this->validate($metric);
public function update($id, array $array)
{
$metric = $this->model->findOrFail($id);
$metric->fill($array);
$metric->update($array);
return $metric;
}
$this->validate($metric);
$metric->update($array);
return $metric;
}
}

View File

@ -2,13 +2,14 @@
namespace CachetHQ\Cachet\Repositories\MetricPoint;
interface MetricPointRepository {
interface MetricPointRepository
{
public function all();
public function all();
public function create(array $array);
public function create(array $array);
public function findOrFail($id);
public function findOrFail($id);
public function update($id, array $with);
public function update($id, array $with);
}

View File

@ -2,18 +2,19 @@
namespace CachetHQ\Cachet\Service\Email;
class EmailService implements ServiceInterface {
class EmailService implements ServiceInterface
{
protected $properties;
public function register() {
public function register()
{
}
public function unregister() {
public function unregister()
{
}
public function fire($data) {
public function fire($data)
{
}
}

View File

@ -2,7 +2,8 @@
namespace CachetHQ\Cachet\Service;
interface ServiceInterface {
interface ServiceInterface
{
public function register();
public function unregister();
public function fire($data);

View File

@ -4,19 +4,21 @@ namespace CachetHQ\Cachet\Support\ServiceProviders;
use Illuminate\Support\ServiceProvider;
class RepositoryServiceProvider extends ServiceProvider {
public function register() {
$this->app->bind(
'CachetHQ\Cachet\Repositories\Component\ComponentRepository',
'CachetHQ\Cachet\Repositories\Component\EloquentComponentRepository'
);
$this->app->bind(
'CachetHQ\Cachet\Repositories\Incident\IncidentRepository',
'CachetHQ\Cachet\Repositories\Incident\EloquentIncidentRepository'
);
$this->app->bind(
'CachetHQ\Cachet\Repositories\Metric\MetricRepository',
'CachetHQ\Cachet\Repositories\Metric\EloquentMetricRepository'
);
}
class RepositoryServiceProvider extends ServiceProvider
{
public function register()
{
$this->app->bind(
'CachetHQ\Cachet\Repositories\Component\ComponentRepository',
'CachetHQ\Cachet\Repositories\Component\EloquentComponentRepository'
);
$this->app->bind(
'CachetHQ\Cachet\Repositories\Incident\IncidentRepository',
'CachetHQ\Cachet\Repositories\Incident\EloquentIncidentRepository'
);
$this->app->bind(
'CachetHQ\Cachet\Repositories\Metric\MetricRepository',
'CachetHQ\Cachet\Repositories\Metric\EloquentMetricRepository'
);
}
}

View File

@ -5,31 +5,35 @@ namespace CachetHQ\Cachet\Support\ServiceProviders;
use Illuminate\Support\ServiceProvider;
use RecursiveDirectoryIterator;
class RoutingServiceProvider extends ServiceProvider {
class RoutingServiceProvider extends ServiceProvider
{
public function register() {}
public function register()
{
}
public function boot() {
$this->routesInDirectory();
}
public function boot()
{
$this->routesInDirectory();
}
/**
* Organise Routes
* @param string $app
*/
private function routesInDirectory($app = '') {
$routeDir = app_path('routes/' . $app . ($app !== '' ? '/' : null));
/**
* Organise Routes
* @param string $app
*/
private function routesInDirectory($app = '')
{
$routeDir = app_path('routes/'.$app.($app !== '' ? '/' : null));
$iterator = new RecursiveDirectoryIterator($routeDir);
$iterator->setFlags(RecursiveDirectoryIterator::SKIP_DOTS);
$iterator = new RecursiveDirectoryIterator($routeDir);
$iterator->setFlags(RecursiveDirectoryIterator::SKIP_DOTS);
foreach ($iterator as $route) {
$isDotFile = strpos($route->getFilename(), '.') === 0;
if (!$isDotFile && !$route->isDir()) {
require $routeDir . $route->getFilename();
}
}
}
foreach ($iterator as $route) {
$isDotFile = strpos($route->getFilename(), '.') === 0;
if (!$isDotFile && !$route->isDir()) {
require $routeDir.$route->getFilename();
}
}
}
}

View File

@ -5,9 +5,11 @@ namespace CachetHQ\Cachet\Transformers;
use Component;
use League\Fractal\TransformerAbstract;
class ComponentTransformer extends TransformerAbstract {
class ComponentTransformer extends TransformerAbstract
{
public function transform(Component $component) {
public function transform(Component $component)
{
return [
'id' => (int) $component->id,
'name' => $component->name,
@ -19,5 +21,4 @@ class ComponentTransformer extends TransformerAbstract {
'updated_at' => $component->updated_at->timestamp,
];
}
}

View File

@ -5,9 +5,11 @@ namespace CachetHQ\Cachet\Transformers;
use Incident;
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;
$transformer = $component->getTransformer();

View File

@ -2,12 +2,14 @@
namespace CachetHQ\Cachet\Transformers;
use MetricPoint;
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 [
'id' => (int) $metricPoint->id,
'metric_id' => $metricPoint->metric_id,
@ -16,5 +18,4 @@ class MetricPointTransformer extends TransformerAbstract {
'updated_at' => $metricPoint->updated_at->timestamp,
];
}
}

View File

@ -2,12 +2,14 @@
namespace CachetHQ\Cachet\Transformers;
use Metric;
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 [
'id' => (int) $metric->id,
'name' => $metric->name,
@ -18,5 +20,4 @@ class MetricTransformer extends TransformerAbstract {
'updated_at' => $metric->updated_at->timestamp,
];
}
}

View File

@ -1,204 +1,204 @@
<?php
return array(
return [
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => false,
'debug' => false,
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => 'http://localhost',
'url' => 'http://localhost',
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'UTC',
'timezone' => 'UTC',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => 'en',
'locale' => 'en',
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'en',
'fallback_locale' => 'en',
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => 'kCifbUiHYswooAvSZBQjWZVY1S6aBdnD',
'key' => 'kCifbUiHYswooAvSZBQjWZVY1S6aBdnD',
'cipher' => MCRYPT_RIJNDAEL_128,
'cipher' => MCRYPT_RIJNDAEL_128,
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'providers' => array(
'providers' => [
'Illuminate\Foundation\Providers\ArtisanServiceProvider',
'Illuminate\Auth\AuthServiceProvider',
'Illuminate\Cache\CacheServiceProvider',
'Illuminate\Session\CommandsServiceProvider',
'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider',
'Illuminate\Routing\ControllerServiceProvider',
'Illuminate\Cookie\CookieServiceProvider',
'Illuminate\Database\DatabaseServiceProvider',
'Illuminate\Encryption\EncryptionServiceProvider',
'Illuminate\Filesystem\FilesystemServiceProvider',
'Illuminate\Hashing\HashServiceProvider',
'Illuminate\Html\HtmlServiceProvider',
'Illuminate\Log\LogServiceProvider',
'Illuminate\Mail\MailServiceProvider',
'Illuminate\Database\MigrationServiceProvider',
'Illuminate\Pagination\PaginationServiceProvider',
'Illuminate\Queue\QueueServiceProvider',
'Illuminate\Redis\RedisServiceProvider',
'Illuminate\Remote\RemoteServiceProvider',
'Illuminate\Auth\Reminders\ReminderServiceProvider',
'Illuminate\Database\SeedServiceProvider',
'Illuminate\Session\SessionServiceProvider',
'Illuminate\Translation\TranslationServiceProvider',
'Illuminate\Validation\ValidationServiceProvider',
'Illuminate\View\ViewServiceProvider',
'Illuminate\Workbench\WorkbenchServiceProvider',
'Illuminate\Foundation\Providers\ArtisanServiceProvider',
'Illuminate\Auth\AuthServiceProvider',
'Illuminate\Cache\CacheServiceProvider',
'Illuminate\Session\CommandsServiceProvider',
'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider',
'Illuminate\Routing\ControllerServiceProvider',
'Illuminate\Cookie\CookieServiceProvider',
'Illuminate\Database\DatabaseServiceProvider',
'Illuminate\Encryption\EncryptionServiceProvider',
'Illuminate\Filesystem\FilesystemServiceProvider',
'Illuminate\Hashing\HashServiceProvider',
'Illuminate\Html\HtmlServiceProvider',
'Illuminate\Log\LogServiceProvider',
'Illuminate\Mail\MailServiceProvider',
'Illuminate\Database\MigrationServiceProvider',
'Illuminate\Pagination\PaginationServiceProvider',
'Illuminate\Queue\QueueServiceProvider',
'Illuminate\Redis\RedisServiceProvider',
'Illuminate\Remote\RemoteServiceProvider',
'Illuminate\Auth\Reminders\ReminderServiceProvider',
'Illuminate\Database\SeedServiceProvider',
'Illuminate\Session\SessionServiceProvider',
'Illuminate\Translation\TranslationServiceProvider',
'Illuminate\Validation\ValidationServiceProvider',
'Illuminate\View\ViewServiceProvider',
'Illuminate\Workbench\WorkbenchServiceProvider',
'Dingo\Api\Provider\ApiServiceProvider',
'Thujohn\Rss\RssServiceProvider',
'Dingo\Api\Provider\ApiServiceProvider',
'Thujohn\Rss\RssServiceProvider',
'CachetHQ\Cachet\Support\ServiceProviders\RepositoryServiceProvider',
'CachetHQ\Cachet\Support\ServiceProviders\RoutingServiceProvider',
),
'CachetHQ\Cachet\Support\ServiceProviders\RepositoryServiceProvider',
'CachetHQ\Cachet\Support\ServiceProviders\RoutingServiceProvider',
/*
|--------------------------------------------------------------------------
| Service Provider Manifest
|--------------------------------------------------------------------------
|
| The service provider manifest is used by Laravel to lazy load service
| providers which are not needed for each request, as well to keep a
| list of all of the services. Here, you may set its storage spot.
|
*/
],
'manifest' => storage_path().'/meta',
/*
|--------------------------------------------------------------------------
| Service Provider Manifest
|--------------------------------------------------------------------------
|
| The service provider manifest is used by Laravel to lazy load service
| providers which are not needed for each request, as well to keep a
| list of all of the services. Here, you may set its storage spot.
|
*/
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'manifest' => storage_path().'/meta',
'aliases' => array(
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'App' => 'Illuminate\Support\Facades\App',
'Artisan' => 'Illuminate\Support\Facades\Artisan',
'Auth' => 'Illuminate\Support\Facades\Auth',
'Blade' => 'Illuminate\Support\Facades\Blade',
'Cache' => 'Illuminate\Support\Facades\Cache',
'Carbon' => 'Carbon\Carbon',
'ClassLoader' => 'Illuminate\Support\ClassLoader',
'Config' => 'Illuminate\Support\Facades\Config',
'Controller' => 'Illuminate\Routing\Controller',
'Cookie' => 'Illuminate\Support\Facades\Cookie',
'Crypt' => 'Illuminate\Support\Facades\Crypt',
'DB' => 'Illuminate\Support\Facades\DB',
'Eloquent' => 'Illuminate\Database\Eloquent\Model',
'Event' => 'Illuminate\Support\Facades\Event',
'File' => 'Illuminate\Support\Facades\File',
'Form' => 'Illuminate\Support\Facades\Form',
'Hash' => 'Illuminate\Support\Facades\Hash',
'HTML' => 'Illuminate\Support\Facades\HTML',
'Input' => 'Illuminate\Support\Facades\Input',
'Lang' => 'Illuminate\Support\Facades\Lang',
'Log' => 'Illuminate\Support\Facades\Log',
'Mail' => 'Illuminate\Support\Facades\Mail',
'Paginator' => 'Illuminate\Support\Facades\Paginator',
'Password' => 'Illuminate\Support\Facades\Password',
'Queue' => 'Illuminate\Support\Facades\Queue',
'Redirect' => 'Illuminate\Support\Facades\Redirect',
'Redis' => 'Illuminate\Support\Facades\Redis',
'Request' => 'Illuminate\Support\Facades\Request',
'Response' => 'Illuminate\Support\Facades\Response',
'Route' => 'Illuminate\Support\Facades\Route',
'Schema' => 'Illuminate\Support\Facades\Schema',
'Seeder' => 'Illuminate\Database\Seeder',
'Session' => 'Illuminate\Support\Facades\Session',
'SoftDeletingTrait' => 'Illuminate\Database\Eloquent\SoftDeletingTrait',
'SSH' => 'Illuminate\Support\Facades\SSH',
'Str' => 'Illuminate\Support\Str',
'URL' => 'Illuminate\Support\Facades\URL',
'Validator' => 'Illuminate\Support\Facades\Validator',
'View' => 'Illuminate\Support\Facades\View',
'aliases' => [
'API' => 'Dingo\Api\Facade\API',
'RSS' => 'Thujohn\Rss\RssFacade',
'App' => 'Illuminate\Support\Facades\App',
'Artisan' => 'Illuminate\Support\Facades\Artisan',
'Auth' => 'Illuminate\Support\Facades\Auth',
'Blade' => 'Illuminate\Support\Facades\Blade',
'Cache' => 'Illuminate\Support\Facades\Cache',
'Carbon' => 'Carbon\Carbon',
'ClassLoader' => 'Illuminate\Support\ClassLoader',
'Config' => 'Illuminate\Support\Facades\Config',
'Controller' => 'Illuminate\Routing\Controller',
'Cookie' => 'Illuminate\Support\Facades\Cookie',
'Crypt' => 'Illuminate\Support\Facades\Crypt',
'DB' => 'Illuminate\Support\Facades\DB',
'Eloquent' => 'Illuminate\Database\Eloquent\Model',
'Event' => 'Illuminate\Support\Facades\Event',
'File' => 'Illuminate\Support\Facades\File',
'Form' => 'Illuminate\Support\Facades\Form',
'Hash' => 'Illuminate\Support\Facades\Hash',
'HTML' => 'Illuminate\Support\Facades\HTML',
'Input' => 'Illuminate\Support\Facades\Input',
'Lang' => 'Illuminate\Support\Facades\Lang',
'Log' => 'Illuminate\Support\Facades\Log',
'Mail' => 'Illuminate\Support\Facades\Mail',
'Paginator' => 'Illuminate\Support\Facades\Paginator',
'Password' => 'Illuminate\Support\Facades\Password',
'Queue' => 'Illuminate\Support\Facades\Queue',
'Redirect' => 'Illuminate\Support\Facades\Redirect',
'Redis' => 'Illuminate\Support\Facades\Redis',
'Request' => 'Illuminate\Support\Facades\Request',
'Response' => 'Illuminate\Support\Facades\Response',
'Route' => 'Illuminate\Support\Facades\Route',
'Schema' => 'Illuminate\Support\Facades\Schema',
'Seeder' => 'Illuminate\Database\Seeder',
'Session' => 'Illuminate\Support\Facades\Session',
'SoftDeletingTrait' => 'Illuminate\Database\Eloquent\SoftDeletingTrait',
'SSH' => 'Illuminate\Support\Facades\SSH',
'Str' => 'Illuminate\Support\Str',
'URL' => 'Illuminate\Support\Facades\URL',
'Validator' => 'Illuminate\Support\Facades\Validator',
'View' => 'Illuminate\Support\Facades\View',
),
'API' => 'Dingo\Api\Facade\API',
'RSS' => 'Thujohn\Rss\RssFacade',
);
],
];

View File

@ -1,71 +1,71 @@
<?php
return array(
return [
/*
|--------------------------------------------------------------------------
| Default Authentication Driver
|--------------------------------------------------------------------------
|
| This option controls the authentication driver that will be utilized.
| This driver manages the retrieval and authentication of the users
| attempting to get access to protected areas of your application.
|
| Supported: "database", "eloquent"
|
*/
/*
|--------------------------------------------------------------------------
| Default Authentication Driver
|--------------------------------------------------------------------------
|
| This option controls the authentication driver that will be utilized.
| This driver manages the retrieval and authentication of the users
| attempting to get access to protected areas of your application.
|
| Supported: "database", "eloquent"
|
*/
'driver' => 'eloquent',
'driver' => 'eloquent',
/*
|--------------------------------------------------------------------------
| Authentication Model
|--------------------------------------------------------------------------
|
| When using the "Eloquent" authentication driver, we need to know which
| Eloquent model should be used to retrieve your users. Of course, it
| is often just the "User" model but you may use whatever you like.
|
*/
/*
|--------------------------------------------------------------------------
| Authentication Model
|--------------------------------------------------------------------------
|
| When using the "Eloquent" authentication driver, we need to know which
| Eloquent model should be used to retrieve your users. Of course, it
| is often just the "User" model but you may use whatever you like.
|
*/
'model' => 'User',
'model' => 'User',
/*
|--------------------------------------------------------------------------
| Authentication Table
|--------------------------------------------------------------------------
|
| When using the "Database" authentication driver, we need to know which
| table should be used to retrieve your users. We have chosen a basic
| default value but you may easily change it to any table you like.
|
*/
/*
|--------------------------------------------------------------------------
| Authentication Table
|--------------------------------------------------------------------------
|
| When using the "Database" authentication driver, we need to know which
| table should be used to retrieve your users. We have chosen a basic
| default value but you may easily change it to any table you like.
|
*/
'table' => 'users',
'table' => 'users',
/*
|--------------------------------------------------------------------------
| Password Reminder Settings
|--------------------------------------------------------------------------
|
| Here you may set the settings for password reminders, including a view
| that should be used as your password reminder e-mail. You will also
| be able to set the name of the table that holds the reset tokens.
|
| The "expire" time is the number of minutes that the reminder should be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
*/
/*
|--------------------------------------------------------------------------
| Password Reminder Settings
|--------------------------------------------------------------------------
|
| Here you may set the settings for password reminders, including a view
| that should be used as your password reminder e-mail. You will also
| be able to set the name of the table that holds the reset tokens.
|
| The "expire" time is the number of minutes that the reminder should be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
*/
'reminder' => array(
'reminder' => [
'email' => 'emails.auth.reminder',
'email' => 'emails.auth.reminder',
'table' => 'password_reminders',
'table' => 'password_reminders',
'expire' => 60,
'expire' => 60,
),
],
);
];

View File

@ -1,89 +1,89 @@
<?php
return array(
return [
/*
|--------------------------------------------------------------------------
| Default Cache Driver
|--------------------------------------------------------------------------
|
| This option controls the default cache "driver" that will be used when
| using the Caching library. Of course, you may use other drivers any
| time you wish. This is the default when another is not specified.
|
| Supported: "file", "database", "apc", "memcached", "redis", "array"
|
*/
/*
|--------------------------------------------------------------------------
| Default Cache Driver
|--------------------------------------------------------------------------
|
| This option controls the default cache "driver" that will be used when
| using the Caching library. Of course, you may use other drivers any
| time you wish. This is the default when another is not specified.
|
| Supported: "file", "database", "apc", "memcached", "redis", "array"
|
*/
'driver' => 'file',
'driver' => 'file',
/*
|--------------------------------------------------------------------------
| File Cache Location
|--------------------------------------------------------------------------
|
| When using the "file" cache driver, we need a location where the cache
| files may be stored. A sensible default has been specified, but you
| are free to change it to any other place on disk that you desire.
|
*/
/*
|--------------------------------------------------------------------------
| File Cache Location
|--------------------------------------------------------------------------
|
| When using the "file" cache driver, we need a location where the cache
| files may be stored. A sensible default has been specified, but you
| are free to change it to any other place on disk that you desire.
|
*/
'path' => storage_path().'/cache',
'path' => storage_path().'/cache',
/*
|--------------------------------------------------------------------------
| Database Cache Connection
|--------------------------------------------------------------------------
|
| When using the "database" cache driver you may specify the connection
| that should be used to store the cached items. When this option is
| null the default database connection will be utilized for cache.
|
*/
/*
|--------------------------------------------------------------------------
| Database Cache Connection
|--------------------------------------------------------------------------
|
| When using the "database" cache driver you may specify the connection
| that should be used to store the cached items. When this option is
| null the default database connection will be utilized for cache.
|
*/
'connection' => null,
'connection' => null,
/*
|--------------------------------------------------------------------------
| Database Cache Table
|--------------------------------------------------------------------------
|
| When using the "database" cache driver we need to know the table that
| should be used to store the cached items. A default table name has
| been provided but you're free to change it however you deem fit.
|
*/
/*
|--------------------------------------------------------------------------
| Database Cache Table
|--------------------------------------------------------------------------
|
| When using the "database" cache driver we need to know the table that
| should be used to store the cached items. A default table name has
| been provided but you're free to change it however you deem fit.
|
*/
'table' => 'cache',
'table' => 'cache',
/*
|--------------------------------------------------------------------------
| Memcached Servers
|--------------------------------------------------------------------------
|
| Now you may specify an array of your Memcached servers that should be
| used when utilizing the Memcached cache driver. All of the servers
| should contain a value for "host", "port", and "weight" options.
|
*/
/*
|--------------------------------------------------------------------------
| Memcached Servers
|--------------------------------------------------------------------------
|
| Now you may specify an array of your Memcached servers that should be
| used when utilizing the Memcached cache driver. All of the servers
| should contain a value for "host", "port", and "weight" options.
|
*/
'memcached' => array(
'memcached' => [
array('host' => '127.0.0.1', 'port' => 11211, 'weight' => 100),
['host' => '127.0.0.1', 'port' => 11211, 'weight' => 100],
),
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
|
*/
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
|
*/
'prefix' => 'laravel',
'prefix' => 'laravel',
);
];

View File

@ -1,18 +1,16 @@
<?php
return array(
return [
/*
|--------------------------------------------------------------------------
| Additional Compiled Classes
|--------------------------------------------------------------------------
|
| Here you may specify additional classes to include in the compiled file
| generated by the `artisan optimize` command. These should be classes
| that are included on basically every request into the application.
|
*/
/*
|--------------------------------------------------------------------------
| Additional Compiled Classes
|--------------------------------------------------------------------------
|
| Here you may specify additional classes to include in the compiled file
| generated by the `artisan optimize` command. These should be classes
| that are included on basically every request into the application.
|
*/
);
];

View File

@ -1,124 +1,124 @@
<?php
return array(
return [
/*
|--------------------------------------------------------------------------
| PDO Fetch Style
|--------------------------------------------------------------------------
|
| By default, database results will be returned as instances of the PHP
| stdClass object; however, you may desire to retrieve records in an
| array format for simplicity. Here you can tweak the fetch style.
|
*/
/*
|--------------------------------------------------------------------------
| PDO Fetch Style
|--------------------------------------------------------------------------
|
| By default, database results will be returned as instances of the PHP
| stdClass object; however, you may desire to retrieve records in an
| array format for simplicity. Here you can tweak the fetch style.
|
*/
'fetch' => PDO::FETCH_CLASS,
'fetch' => PDO::FETCH_CLASS,
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
*/
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
*/
'default' => $_ENV['DB_DRIVER'],
'default' => $_ENV['DB_DRIVER'],
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
'connections' => array(
'connections' => [
'sqlite' => array(
'driver' => 'sqlite',
'database' => __DIR__.'/../database/'.$_ENV['DB_DATABASE'],
'prefix' => '',
),
'sqlite' => [
'driver' => 'sqlite',
'database' => __DIR__.'/../database/'.$_ENV['DB_DATABASE'],
'prefix' => '',
],
'mysql' => array(
'driver' => 'mysql',
'host' => $_ENV['DB_HOST'],
'database' => $_ENV['DB_DATABASE'],
'username' => $_ENV['DB_USERNAME'],
'password' => $_ENV['DB_PASSWORD'],
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
'mysql' => [
'driver' => 'mysql',
'host' => $_ENV['DB_HOST'],
'database' => $_ENV['DB_DATABASE'],
'username' => $_ENV['DB_USERNAME'],
'password' => $_ENV['DB_PASSWORD'],
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
],
'pgsql' => array(
'driver' => 'pgsql',
'host' => $_ENV['DB_HOST'],
'database' => $_ENV['DB_DATABASE'],
'username' => $_ENV['DB_USERNAME'],
'password' => $_ENV['DB_PASSWORD'],
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
),
'pgsql' => [
'driver' => 'pgsql',
'host' => $_ENV['DB_HOST'],
'database' => $_ENV['DB_DATABASE'],
'username' => $_ENV['DB_USERNAME'],
'password' => $_ENV['DB_PASSWORD'],
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
],
'sqlsrv' => array(
'driver' => 'sqlsrv',
'host' => $_ENV['DB_HOST'],
'database' => $_ENV['DB_DATABASE'],
'username' => $_ENV['DB_USERNAME'],
'password' => $_ENV['DB_PASSWORD'],
'prefix' => '',
),
'sqlsrv' => [
'driver' => 'sqlsrv',
'host' => $_ENV['DB_HOST'],
'database' => $_ENV['DB_DATABASE'],
'username' => $_ENV['DB_USERNAME'],
'password' => $_ENV['DB_PASSWORD'],
'prefix' => '',
],
),
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
*/
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
*/
'migrations' => 'migrations',
'migrations' => 'migrations',
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer set of commands than a typical key-value systems
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer set of commands than a typical key-value systems
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'redis' => array(
'redis' => [
'cluster' => false,
'cluster' => false,
'default' => array(
'host' => '127.0.0.1',
'port' => 6379,
'database' => 0,
),
'default' => [
'host' => '127.0.0.1',
'port' => 6379,
'database' => 0,
],
),
],
);
];

View File

@ -3,10 +3,10 @@
$dbURL = parse_url(getenv('CLEARDB_DATABASE_URL'));
$dbName = substr($dbURL["path"], 1);
return array(
'default' => 'cleardb',
'connections' => array(
'cleardb' => array(
return [
'default' => 'cleardb',
'connections' => [
'cleardb' => [
'driver' => 'mysql',
'host' => $dbURL['host'],
'database' => $dbName,
@ -15,6 +15,6 @@ return array(
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
)
);
],
],
];

View File

@ -1,20 +1,20 @@
<?php
return array(
return [
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => true,
'debug' => true,
'url' => 'http://cachet.io.dev',
'url' => 'http://cachet.io.dev',
);
];

View File

@ -1,124 +1,124 @@
<?php
return array(
return [
/*
|--------------------------------------------------------------------------
| Mail Driver
|--------------------------------------------------------------------------
|
| Laravel supports both SMTP and PHP's "mail" function as drivers for the
| sending of e-mail. You may specify which one you're using throughout
| your application here. By default, Laravel is setup for SMTP mail.
|
| Supported: "smtp", "mail", "sendmail", "mailgun", "mandrill", "log"
|
*/
/*
|--------------------------------------------------------------------------
| Mail Driver
|--------------------------------------------------------------------------
|
| Laravel supports both SMTP and PHP's "mail" function as drivers for the
| sending of e-mail. You may specify which one you're using throughout
| your application here. By default, Laravel is setup for SMTP mail.
|
| Supported: "smtp", "mail", "sendmail", "mailgun", "mandrill", "log"
|
*/
'driver' => 'smtp',
'driver' => 'smtp',
/*
|--------------------------------------------------------------------------
| SMTP Host Address
|--------------------------------------------------------------------------
|
| Here you may provide the host address of the SMTP server used by your
| applications. A default option is provided that is compatible with
| the Mailgun mail service which will provide reliable deliveries.
|
*/
/*
|--------------------------------------------------------------------------
| SMTP Host Address
|--------------------------------------------------------------------------
|
| Here you may provide the host address of the SMTP server used by your
| applications. A default option is provided that is compatible with
| the Mailgun mail service which will provide reliable deliveries.
|
*/
'host' => 'smtp.mailgun.org',
'host' => 'smtp.mailgun.org',
/*
|--------------------------------------------------------------------------
| SMTP Host Port
|--------------------------------------------------------------------------
|
| This is the SMTP port used by your application to deliver e-mails to
| users of the application. Like the host we have set this value to
| stay compatible with the Mailgun e-mail application by default.
|
*/
/*
|--------------------------------------------------------------------------
| SMTP Host Port
|--------------------------------------------------------------------------
|
| This is the SMTP port used by your application to deliver e-mails to
| users of the application. Like the host we have set this value to
| stay compatible with the Mailgun e-mail application by default.
|
*/
'port' => 587,
'port' => 587,
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
*/
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
*/
'from' => array('address' => null, 'name' => null),
'from' => ['address' => null, 'name' => null],
/*
|--------------------------------------------------------------------------
| E-Mail Encryption Protocol
|--------------------------------------------------------------------------
|
| Here you may specify the encryption protocol that should be used when
| the application send e-mail messages. A sensible default using the
| transport layer security protocol should provide great security.
|
*/
/*
|--------------------------------------------------------------------------
| E-Mail Encryption Protocol
|--------------------------------------------------------------------------
|
| Here you may specify the encryption protocol that should be used when
| the application send e-mail messages. A sensible default using the
| transport layer security protocol should provide great security.
|
*/
'encryption' => 'tls',
'encryption' => 'tls',
/*
|--------------------------------------------------------------------------
| SMTP Server Username
|--------------------------------------------------------------------------
|
| If your SMTP server requires a username for authentication, you should
| set it here. This will get used to authenticate with your server on
| connection. You may also set the "password" value below this one.
|
*/
/*
|--------------------------------------------------------------------------
| SMTP Server Username
|--------------------------------------------------------------------------
|
| If your SMTP server requires a username for authentication, you should
| set it here. This will get used to authenticate with your server on
| connection. You may also set the "password" value below this one.
|
*/
'username' => null,
'username' => null,
/*
|--------------------------------------------------------------------------
| SMTP Server Password
|--------------------------------------------------------------------------
|
| Here you may set the password required by your SMTP server to send out
| messages from your application. This will be given to the server on
| connection so that the application will be able to send messages.
|
*/
/*
|--------------------------------------------------------------------------
| SMTP Server Password
|--------------------------------------------------------------------------
|
| Here you may set the password required by your SMTP server to send out
| messages from your application. This will be given to the server on
| connection so that the application will be able to send messages.
|
*/
'password' => null,
'password' => null,
/*
|--------------------------------------------------------------------------
| Sendmail System Path
|--------------------------------------------------------------------------
|
| When using the "sendmail" driver to send e-mails, we will need to know
| the path to where Sendmail lives on this server. A default path has
| been provided here, which will work well on most of your systems.
|
*/
/*
|--------------------------------------------------------------------------
| Sendmail System Path
|--------------------------------------------------------------------------
|
| When using the "sendmail" driver to send e-mails, we will need to know
| the path to where Sendmail lives on this server. A default path has
| been provided here, which will work well on most of your systems.
|
*/
'sendmail' => '/usr/sbin/sendmail -bs',
'sendmail' => '/usr/sbin/sendmail -bs',
/*
|--------------------------------------------------------------------------
| Mail "Pretend"
|--------------------------------------------------------------------------
|
| When this option is enabled, e-mail will not actually be sent over the
| web and will instead be written to your application's logs files so
| you may inspect the message. This is great for local development.
|
*/
/*
|--------------------------------------------------------------------------
| Mail "Pretend"
|--------------------------------------------------------------------------
|
| When this option is enabled, e-mail will not actually be sent over the
| web and will instead be written to your application's logs files so
| you may inspect the message. This is great for local development.
|
*/
'pretend' => false,
'pretend' => false,
);
];

View File

@ -78,7 +78,7 @@ return [
'auth' => [
'basic' => function ($app) {
return new Dingo\Api\Auth\BasicProvider($app['auth']);
}
},
],
/*
@ -101,15 +101,15 @@ return [
'authenticated' => [
'limit' => 0,
'reset' => 60
'reset' => 60,
],
'unauthenticated' => [
'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) {
$fractal = new League\Fractal\Manager;
$fractal = new League\Fractal\Manager();
return new Dingo\Api\Transformer\FractalTransformer($fractal);
},
@ -146,7 +146,7 @@ return [
'formats' => [
'json' => new Dingo\Api\Http\ResponseFormat\JsonResponseFormat
'json' => new Dingo\Api\Http\ResponseFormat\JsonResponseFormat(),
]

View File

@ -1,85 +1,85 @@
<?php
return array(
return [
/*
|--------------------------------------------------------------------------
| Default Queue Driver
|--------------------------------------------------------------------------
|
| The Laravel queue API supports a variety of back-ends via an unified
| API, giving you convenient access to each back-end using the same
| syntax for each one. Here you may set the default queue driver.
|
| Supported: "sync", "beanstalkd", "sqs", "iron", "redis"
|
*/
/*
|--------------------------------------------------------------------------
| Default Queue Driver
|--------------------------------------------------------------------------
|
| The Laravel queue API supports a variety of back-ends via an unified
| API, giving you convenient access to each back-end using the same
| syntax for each one. Here you may set the default queue driver.
|
| Supported: "sync", "beanstalkd", "sqs", "iron", "redis"
|
*/
'default' => 'sync',
'default' => 'sync',
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection information for each server that
| is used by your application. A default configuration has been added
| for each back-end shipped with Laravel. You are free to add more.
|
*/
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection information for each server that
| is used by your application. A default configuration has been added
| for each back-end shipped with Laravel. You are free to add more.
|
*/
'connections' => array(
'connections' => [
'sync' => array(
'driver' => 'sync',
),
'sync' => [
'driver' => 'sync',
],
'beanstalkd' => array(
'driver' => 'beanstalkd',
'host' => 'localhost',
'queue' => 'default',
'ttr' => 60,
),
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => 'localhost',
'queue' => 'default',
'ttr' => 60,
],
'sqs' => array(
'driver' => 'sqs',
'key' => 'your-public-key',
'secret' => 'your-secret-key',
'queue' => 'your-queue-url',
'region' => 'us-east-1',
),
'sqs' => [
'driver' => 'sqs',
'key' => 'your-public-key',
'secret' => 'your-secret-key',
'queue' => 'your-queue-url',
'region' => 'us-east-1',
],
'iron' => array(
'driver' => 'iron',
'host' => 'mq-aws-us-east-1.iron.io',
'token' => 'your-token',
'project' => 'your-project-id',
'queue' => 'your-queue-name',
'encrypt' => true,
),
'iron' => [
'driver' => 'iron',
'host' => 'mq-aws-us-east-1.iron.io',
'token' => 'your-token',
'project' => 'your-project-id',
'queue' => 'your-queue-name',
'encrypt' => true,
],
'redis' => array(
'driver' => 'redis',
'queue' => 'default',
),
'redis' => [
'driver' => 'redis',
'queue' => 'default',
],
),
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control which database and table are used to store the jobs that
| have failed. You may change them to any database / table you wish.
|
*/
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control which database and table are used to store the jobs that
| have failed. You may change them to any database / table you wish.
|
*/
'failed' => array(
'failed' => [
'database' => 'mysql', 'table' => 'failed_jobs',
'database' => 'mysql', 'table' => 'failed_jobs',
),
],
);
];

View File

@ -1,59 +1,59 @@
<?php
return array(
return [
/*
|--------------------------------------------------------------------------
| Default Remote Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify the default connection that will be used for SSH
| operations. This name should correspond to a connection name below
| in the server list. Each connection will be manually accessible.
|
*/
/*
|--------------------------------------------------------------------------
| Default Remote Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify the default connection that will be used for SSH
| operations. This name should correspond to a connection name below
| in the server list. Each connection will be manually accessible.
|
*/
'default' => 'production',
'default' => 'production',
/*
|--------------------------------------------------------------------------
| Remote Server Connections
|--------------------------------------------------------------------------
|
| These are the servers that will be accessible via the SSH task runner
| facilities of Laravel. This feature radically simplifies executing
| tasks on your servers, such as deploying out these applications.
|
*/
/*
|--------------------------------------------------------------------------
| Remote Server Connections
|--------------------------------------------------------------------------
|
| These are the servers that will be accessible via the SSH task runner
| facilities of Laravel. This feature radically simplifies executing
| tasks on your servers, such as deploying out these applications.
|
*/
'connections' => array(
'connections' => [
'production' => array(
'host' => '',
'username' => '',
'password' => '',
'key' => '',
'keyphrase' => '',
'root' => '/var/www',
),
'production' => [
'host' => '',
'username' => '',
'password' => '',
'key' => '',
'keyphrase' => '',
'root' => '/var/www',
],
),
],
/*
|--------------------------------------------------------------------------
| Remote Server Groups
|--------------------------------------------------------------------------
|
| Here you may list connections under a single group name, which allows
| you to easily access all of the servers at once using a short name
| that is extremely easy to remember, such as "web" or "database".
|
*/
/*
|--------------------------------------------------------------------------
| Remote Server Groups
|--------------------------------------------------------------------------
|
| Here you may list connections under a single group name, which allows
| you to easily access all of the servers at once using a short name
| that is extremely easy to remember, such as "web" or "database".
|
*/
'groups' => array(
'groups' => [
'web' => array('production')
'web' => ['production'],
),
],
);
];

View File

@ -1,31 +1,31 @@
<?php
return array(
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Stripe, Mailgun, Mandrill, and others. This file provides a sane
| default location for this type of information, allowing packages
| to have a conventional place to find your various credentials.
|
*/
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Stripe, Mailgun, Mandrill, and others. This file provides a sane
| default location for this type of information, allowing packages
| to have a conventional place to find your various credentials.
|
*/
'mailgun' => array(
'domain' => '',
'secret' => '',
),
'mailgun' => [
'domain' => '',
'secret' => '',
],
'mandrill' => array(
'secret' => '',
),
'mandrill' => [
'secret' => '',
],
'stripe' => array(
'model' => 'User',
'secret' => '',
),
'stripe' => [
'model' => 'User',
'secret' => '',
],
);
];

View File

@ -1,140 +1,140 @@
<?php
return array(
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option controls the default session "driver" that will be used on
| requests. By default, we will use the lightweight native driver but
| you may specify any of the other wonderful drivers provided here.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "array"
|
*/
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option controls the default session "driver" that will be used on
| requests. By default, we will use the lightweight native driver but
| you may specify any of the other wonderful drivers provided here.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "array"
|
*/
'driver' => 'database',
'driver' => 'database',
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
*/
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
*/
'lifetime' => 120,
'lifetime' => 120,
'expire_on_close' => false,
'expire_on_close' => false,
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When using the native session driver, we need a location where session
| files may be stored. A default has been set for you but a different
| location may be specified. This is only needed for file sessions.
|
*/
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When using the native session driver, we need a location where session
| files may be stored. A default has been set for you but a different
| location may be specified. This is only needed for file sessions.
|
*/
'files' => storage_path().'/sessions',
'files' => storage_path().'/sessions',
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => null,
'connection' => null,
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table we
| should use to manage the sessions. Of course, a sensible default is
| provided for you; however, you are free to change this as needed.
|
*/
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table we
| should use to manage the sessions. Of course, a sensible default is
| provided for you; however, you are free to change this as needed.
|
*/
'table' => 'sessions',
'table' => 'sessions',
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => array(2, 100),
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the cookie used to identify a session
| instance by ID. The name specified here will get used every time a
| new session cookie is created by the framework for every driver.
|
*/
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the cookie used to identify a session
| instance by ID. The name specified here will get used every time a
| new session cookie is created by the framework for every driver.
|
*/
'cookie' => 'laravel_session',
'cookie' => 'laravel_session',
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application but you are free to change this when necessary.
|
*/
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application but you are free to change this when necessary.
|
*/
'path' => '/',
'path' => '/',
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| Here you may change the domain of the cookie used to identify a session
| in your application. This will determine which domains the cookie is
| available to in your application. A sensible default has been set.
|
*/
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| Here you may change the domain of the cookie used to identify a session
| in your application. This will determine which domains the cookie is
| available to in your application. A sensible default has been set.
|
*/
'domain' => null,
'domain' => null,
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you if it can not be done securely.
|
*/
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you if it can not be done securely.
|
*/
'secure' => false,
'secure' => false,
);
];

View File

@ -1,20 +1,20 @@
<?php
return array(
return [
/*
|--------------------------------------------------------------------------
| Default Cache Driver
|--------------------------------------------------------------------------
|
| This option controls the default cache "driver" that will be used when
| using the Caching library. Of course, you may use other drivers any
| time you wish. This is the default when another is not specified.
|
| Supported: "file", "database", "apc", "memcached", "redis", "array"
|
*/
/*
|--------------------------------------------------------------------------
| Default Cache Driver
|--------------------------------------------------------------------------
|
| This option controls the default cache "driver" that will be used when
| using the Caching library. Of course, you may use other drivers any
| time you wish. This is the default when another is not specified.
|
| Supported: "file", "database", "apc", "memcached", "redis", "array"
|
*/
'driver' => 'array',
'driver' => 'array',
);
];

View File

@ -1,21 +1,21 @@
<?php
return array(
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option controls the default session "driver" that will be used on
| requests. By default, we will use the lightweight native driver but
| you may specify any of the other wonderful drivers provided here.
|
| Supported: "native", "cookie", "database", "apc",
| "memcached", "redis", "array"
|
*/
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option controls the default session "driver" that will be used on
| requests. By default, we will use the lightweight native driver but
| you may specify any of the other wonderful drivers provided here.
|
| Supported: "native", "cookie", "database", "apc",
| "memcached", "redis", "array"
|
*/
'driver' => 'array',
'driver' => 'array',
);
];

View File

@ -1,31 +1,31 @@
<?php
return array(
return [
/*
|--------------------------------------------------------------------------
| View Storage Paths
|--------------------------------------------------------------------------
|
| Most templating systems load templates from disk. Here you may specify
| an array of paths that should be checked for your views. Of course
| the usual Laravel view path has already been registered for you.
|
*/
/*
|--------------------------------------------------------------------------
| View Storage Paths
|--------------------------------------------------------------------------
|
| Most templating systems load templates from disk. Here you may specify
| an array of paths that should be checked for your views. Of course
| the usual Laravel view path has already been registered for you.
|
*/
'paths' => array(__DIR__.'/../views'),
'paths' => [__DIR__.'/../views'],
/*
|--------------------------------------------------------------------------
| Pagination View
|--------------------------------------------------------------------------
|
| This view will be used to render the pagination link output, and can
| be easily customized here to show any view you like. A clean view
| compatible with Twitter's Bootstrap is given to you by default.
|
*/
/*
|--------------------------------------------------------------------------
| Pagination View
|--------------------------------------------------------------------------
|
| This view will be used to render the pagination link output, and can
| be easily customized here to show any view you like. A clean view
| compatible with Twitter's Bootstrap is given to you by default.
|
*/
'pagination' => 'pagination::slider-3',
'pagination' => 'pagination::slider-3',
);
];

View File

@ -1,31 +1,31 @@
<?php
return array(
return [
/*
|--------------------------------------------------------------------------
| Workbench Author Name
|--------------------------------------------------------------------------
|
| When you create new packages via the Artisan "workbench" command your
| name is needed to generate the composer.json file for your package.
| You may specify it now so it is used for all of your workbenches.
|
*/
/*
|--------------------------------------------------------------------------
| Workbench Author Name
|--------------------------------------------------------------------------
|
| When you create new packages via the Artisan "workbench" command your
| name is needed to generate the composer.json file for your package.
| You may specify it now so it is used for all of your workbenches.
|
*/
'name' => '',
'name' => '',
/*
|--------------------------------------------------------------------------
| Workbench Author E-Mail Address
|--------------------------------------------------------------------------
|
| Like the option above, your e-mail address is used when generating new
| workbench packages. The e-mail is placed in your composer.json file
| automatically after the package is created by the workbench tool.
|
*/
/*
|--------------------------------------------------------------------------
| Workbench Author E-Mail Address
|--------------------------------------------------------------------------
|
| Like the option above, your e-mail address is used when generating new
| workbench packages. The e-mail is placed in your composer.json file
| automatically after the package is created by the workbench tool.
|
*/
'email' => '',
'email' => '',
);
];

View File

@ -3,12 +3,14 @@
/**
* Logs users into their account
*/
class AuthController extends Controller {
class AuthController extends Controller
{
/**
* Shows the login view.
* @return \Illuminate\View\View
*/
public function showLogin() {
public function showLogin()
{
return View::make('auth.login');
}
@ -16,7 +18,8 @@ class AuthController extends Controller {
* Logs the user in.
* @return \Illuminate\Http\RedirectResponse
*/
public function postLogin() {
public function postLogin()
{
if (Auth::attempt(Input::only(['email', 'password']))) {
return Redirect::intended('dashboard');
} else {
@ -30,8 +33,10 @@ class AuthController extends Controller {
* Logs the user out, deleting their session etc.
* @return \Illuminate\Http\RedirectResponse
*/
public function logoutAction() {
public function logoutAction()
{
Auth::logout();
return Redirect::to('/');
}
}

View File

@ -1,71 +1,78 @@
<?php
class DashComponentController extends Controller {
/**
* Shows the components view.
* @return \Illuminate\View\View
*/
public function showComponents() {
$components = Component::all();
class DashComponentController extends Controller
{
/**
* Shows the components view.
* @return \Illuminate\View\View
*/
public function showComponents()
{
$components = Component::all();
return View::make('dashboard.components')->with([
'pageTitle' => 'Components - Dashboard',
'components' => $components
]);
}
return View::make('dashboard.components')->with([
'pageTitle' => 'Components - Dashboard',
'components' => $components,
]);
}
/**
* Shows the edit component view.
* @param Component $component
* @return \Illuminate\View\View
*/
public function showEditComponent(Component $component) {
/**
* Shows the edit component view.
* @param Component $component
* @return \Illuminate\View\View
*/
public function showEditComponent(Component $component)
{
return View::make('dashboard.component-edit')->with([
'pageTitle' => 'Editing "'.$component->name.'" Component - Dashboard',
'component' => $component,
]);
}
return View::make('dashboard.component-edit')->with([
'pageTitle' => 'Editing "' . $component->name . '" Component - Dashboard',
'component' => $component
]);
}
/**
* Updates a component.
* @return \Illuminate\Http\RedirectResponse
*/
public function updateComponentAction(Component $component)
{
$_component = Input::get('component');
$component->update($_component);
/**
* Updates a component.
* @return \Illuminate\Http\RedirectResponse
*/
public function updateComponentAction(Component $component) {
$_component = Input::get('component');
$component->update($_component);
return Redirect::back()->with('savedComponent', $component);
}
return Redirect::back()->with('savedComponent', $component);
}
/**
* Shows the add component view.
* @return \Illuminate\View\View
*/
public function showAddComponent()
{
return View::make('dashboard.component-add')->with([
'pageTitle' => 'Add Component - Dashboard',
]);
}
/**
* Shows the add component view.
* @return \Illuminate\View\View
*/
public function showAddComponent() {
return View::make('dashboard.component-add')->with([
'pageTitle' => 'Add Component - Dashboard',
]);
}
/**
* Creates a new component.
* @return \Illuminate\Http\RedirectResponse
*/
public function createComponentAction()
{
$_component = Input::get('component');
$component = Component::create($_component);
/**
* Creates a new component.
* @return \Illuminate\Http\RedirectResponse
*/
public function createComponentAction() {
$_component = Input::get('component');
$component = Component::create($_component);
return Redirect::back()->with('component', $component);
}
return Redirect::back()->with('component', $component);
}
/**
* Deletes a given component.
* @param Component $component
* @return \Illuminate\Http\RedirectResponse
*/
public function deleteComponentAction(Component $component)
{
$component->delete();
/**
* Deletes a given component.
* @param Component $component
* @return \Illuminate\Http\RedirectResponse
*/
public function deleteComponentAction(Component $component) {
$component->delete();
return Redirect::back();
}
return Redirect::back();
}
}

View File

@ -1,58 +1,64 @@
<?php
class DashIncidentController extends Controller {
/**
* Shows the incidents view.
* @return \Illuminate\View\View
*/
public function showIncidents() {
$incidents = Incident::all();
class DashIncidentController extends Controller
{
/**
* Shows the incidents view.
* @return \Illuminate\View\View
*/
public function showIncidents()
{
$incidents = Incident::all();
return View::make('dashboard.incidents')->with([
'pageTitle' => 'Incidents - Dashboard',
'incidents' => $incidents
]);
}
return View::make('dashboard.incidents')->with([
'pageTitle' => 'Incidents - Dashboard',
'incidents' => $incidents,
]);
}
/**
* Shows the add incident view.
* @return \Illuminate\View\View
*/
public function showAddIncident() {
return View::make('dashboard.incident-add')->with([
'pageTitle' => 'Add Incident - Dashboard',
]);
}
/**
* Shows the add incident view.
* @return \Illuminate\View\View
*/
public function showAddIncident()
{
return View::make('dashboard.incident-add')->with([
'pageTitle' => 'Add Incident - Dashboard',
]);
}
/**
* Shows the add incident template view.
* @return \Illuminate\View\View
*/
public function showAddIncidentTemplate() {
return View::make('dashboard.incident-template')->with([
'pageTitle' => 'Add Incident Template - Dashboard',
]);
}
/**
* Shows the add incident template view.
* @return \Illuminate\View\View
*/
public function showAddIncidentTemplate()
{
return View::make('dashboard.incident-template')->with([
'pageTitle' => 'Add Incident Template - Dashboard',
]);
}
/**
* Creates a new incident template.
* @return \Illuminate\Http\RedirectResponse
*/
public function createIncidentTemplateAction() {
$_template = Input::get('template');
$template = IncidentTemplate::create($_template);
/**
* Creates a new incident template.
* @return \Illuminate\Http\RedirectResponse
*/
public function createIncidentTemplateAction()
{
$_template = Input::get('template');
$template = IncidentTemplate::create($_template);
return Redirect::back()->with('template', $template);
}
return Redirect::back()->with('template', $template);
}
/**
* Creates a new incident.
* @return \Illuminate\Http\RedirectResponse
*/
public function createIncidentAction() {
$_incident = Input::get('incident');
$incident = Incident::create($_incident);
/**
* Creates a new incident.
* @return \Illuminate\Http\RedirectResponse
*/
public function createIncidentAction()
{
$_incident = Input::get('incident');
$incident = Incident::create($_incident);
return Redirect::back()->with('incident', $incident);
}
return Redirect::back()->with('incident', $incident);
}
}

View File

@ -1,40 +1,43 @@
<?php
<?php
class DashSettingsController extends Controller {
/**
* Shows the settings view.
* @return \Illuminate\View\View
*/
public function showSettings() {
return View::make('dashboard.settings')->with([
'pageTitle' => 'Settings - Dashboard'
]);
}
class DashSettingsController extends Controller
{
/**
* Shows the settings view.
* @return \Illuminate\View\View
*/
public function showSettings()
{
return View::make('dashboard.settings')->with([
'pageTitle' => 'Settings - Dashboard',
]);
}
/**
* Updates the statsu page settings.
* @return \Illuminate\View\View
*/
public function postSettings() {
$settings = Input::all();
/**
* Updates the statsu page settings.
* @return \Illuminate\View\View
*/
public function postSettings()
{
$settings = Input::all();
foreach ($settings as $settingName => $settingValue) {
// Don't save empty settings. Kinda useless...
if (!$settingValue) {
continue;
}
foreach ($settings as $settingName => $settingValue) {
// Don't save empty settings. Kinda useless...
if (!$settingValue) {
continue;
}
if (strstr($settingName, 'style_')) {
$settingValue = str_replace('#', '', $settingValue);
}
if (strstr($settingName, 'style_')) {
$settingValue = str_replace('#', '', $settingValue);
}
$setting = Setting::firstOrCreate([
'name' => $settingName,
])->update([
'value' => $settingValue
]);
}
$setting = Setting::firstOrCreate([
'name' => $settingName,
])->update([
'value' => $settingValue,
]);
}
return Redirect::back();
}
return Redirect::back();
}
}

View File

@ -1,11 +1,13 @@
<?php
class DashboardController extends Controller {
class DashboardController extends Controller
{
/**
* Shows the dashboard view.
* @return \Illuminate\View\View
*/
public function showDashboard() {
public function showDashboard()
{
return View::make('dashboard.index');
}
@ -13,9 +15,10 @@ class DashboardController extends Controller {
* Shows the metrics view.
* @return \Illuminate\View\View
*/
public function showMetrics() {
public function showMetrics()
{
return View::make('dashboard.metrics')->with([
'pageTitle' => 'Metrics - Dashboard'
'pageTitle' => 'Metrics - Dashboard',
]);
}
@ -23,9 +26,10 @@ class DashboardController extends Controller {
* Shows the notifications view.
* @return \Illuminate\View\View
*/
public function showNotifications() {
public function showNotifications()
{
return View::make('dashboard.notifications')->with([
'pageTitle' => 'Notifications - Dashboard'
'pageTitle' => 'Notifications - Dashboard',
]);
}
}

View File

@ -1,12 +1,14 @@
<?php
class HomeController extends Controller {
class HomeController extends Controller
{
/**
* @var Component $component
*/
protected $component;
public function __construct(Component $component) {
public function __construct(Component $component)
{
$this->component = $component;
}
@ -14,7 +16,8 @@ class HomeController extends Controller {
* Returns the rendered Blade templates.
* @return \Illuminate\View\View
*/
public function showIndex() {
public function showIndex()
{
return View::make('index', ['components' => $this->component->all()]);
}
}

View File

@ -1,11 +1,13 @@
<?php
class RSSController extends Controller {
class RSSController extends Controller
{
/**
* Generates an RSS feed of all incidents.
* @return \Illuminate\Http\Response
*/
public function feedAction() {
public function feedAction()
{
$feed = RSS::feed('2.0', 'UTF-8');
$feed->channel([
'title' => Setting::get('app_name'),
@ -13,7 +15,7 @@ class RSSController extends Controller {
'link' => Setting::get('app_domain'),
]);
Incident::get()->map(function($incident) use ($feed) {
Incident::get()->map(function ($incident) use ($feed) {
$componentName = null;
$component = $incident->component;
if ($component) {
@ -26,7 +28,7 @@ class RSSController extends Controller {
'component' => $componentName,
'status' => $incident->humanStatus,
'created_at' => $incident->created_at,
'updated_at' => $incident->updated_at
'updated_at' => $incident->updated_at,
]);
});

View File

@ -1,7 +1,9 @@
<?php
class SetupController extends Controller {
public function __construct() {
class SetupController extends Controller
{
public function __construct()
{
$this->beforeFilter('csrf', ['only' => ['postCachet']]);
}
@ -9,9 +11,10 @@ class SetupController extends Controller {
* Returns the setup page.
* @return \Illuminate\View\View
*/
public function getIndex() {
public function getIndex()
{
return View::make('setup')->with([
'pageTitle' => 'Setup'
'pageTitle' => 'Setup',
]);
}
@ -19,7 +22,8 @@ class SetupController extends Controller {
* Handles the actual app setup.
* @return \Illuminate\Http\RedirectResponse
*/
public function postIndex() {
public function postIndex()
{
$postData = Input::get();
$v = Validator::make($postData, [
@ -38,7 +42,7 @@ class SetupController extends Controller {
// TODO: Do we want to just use Eloquent::unguard() here?
$user = User::create([
'username' => $userDetails['username'],
'email' => $userDetails['email'],
'email' => $userDetails['email'],
'password' => $userDetails['password'],
]);
@ -47,7 +51,7 @@ class SetupController extends Controller {
$settings = array_get($postData, 'settings');
foreach ($settings as $settingName => $settingValue) {
$setting = new Setting;
$setting = new Setting();
$setting->name = $settingName;
$setting->value = $settingValue;
$setting->save();

View File

@ -1,40 +1,39 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateIncidentsTable extends Migration {
class CreateIncidentsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('incidents', function(Blueprint $table)
{
$table->increments('id');
$table->tinyInteger('component')->default(1);
$table->string('name');
$table->tinyInteger('status')->default(1);
$table->longText('message');
$table->timestamps();
$table->softDeletes();
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('incidents', function (Blueprint $table) {
$table->increments('id');
$table->tinyInteger('component')->default(1);
$table->string('name');
$table->tinyInteger('status')->default(1);
$table->longText('message');
$table->timestamps();
$table->softDeletes();
$table->index('component');
$table->index('status');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('incidents');
}
$table->index('component');
$table->index('status');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('incidents');
}
}

View File

@ -1,37 +1,36 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateComponentsTable extends Migration {
class CreateComponentsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('components', function(Blueprint $table)
{
$table->increments('id');
$table->string('name');
$table->string('description')->nullable()->default(null);
$table->tinyInteger('status')->default(1);
$table->timestamps();
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('components', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('description')->nullable()->default(null);
$table->tinyInteger('status')->default(1);
$table->timestamps();
$table->index('status');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('components');
}
$table->index('status');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('components');
}
}

View File

@ -1,34 +1,33 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateSettingsTable extends Migration {
class CreateSettingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('settings', function(Blueprint $table)
{
$table->increments('id');
$table->string('name');
$table->text('value')->nullable()->default(null);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('settings');
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('settings', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->text('value')->nullable()->default(null);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('settings');
}
}

View File

@ -1,41 +1,40 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateWebHooksTable extends Migration {
class CreateWebHooksTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('web_hooks', function(Blueprint $table)
{
$table->increments('id');
$table->string('name')->nullable(FALSE);
$table->string('endpoint')->nullable(FALSE);
$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->boolean('active')->default(0);
$table->timestamps();
$table->softDeletes();
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('web_hooks', function (Blueprint $table) {
$table->increments('id');
$table->string('name')->nullable(false);
$table->string('endpoint')->nullable(false);
$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->boolean('active')->default(0);
$table->timestamps();
$table->softDeletes();
// Indexes
$table->index('active');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('web_hooks');
}
// Indexes
$table->index('active');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('web_hooks');
}
}

View File

@ -1,42 +1,41 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateWebHookResponsesTable extends Migration {
class CreateWebHookResponsesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('web_hook_response', function(Blueprint $table)
{
$table->increments('id');
$table->integer('hook_id')->unsigned();
$table->tinyInteger('response_code')->nullable(FALSE); // This should return something like 200, 301 etc.
$table->string('response_type'); // application/json etc.
$table->text('sent_headers');
$table->longText('sent_body'); // What we sent the web hook
$table->text('recv_headers');
$table->longText('recv_body'); // Potentially a big response will be returned
$table->float('time_taken')->default(0); // How long did the request take, in seconds.
$table->timestamps();
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('web_hook_response', function (Blueprint $table) {
$table->increments('id');
$table->integer('hook_id')->unsigned();
$table->tinyInteger('response_code')->nullable(false); // This should return something like 200, 301 etc.
$table->string('response_type'); // application/json etc.
$table->text('sent_headers');
$table->longText('sent_body'); // What we sent the web hook
$table->text('recv_headers');
$table->longText('recv_body'); // Potentially a big response will be returned
$table->float('time_taken')->default(0); // How long did the request take, in seconds.
$table->timestamps();
$table->index('hook_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('web_hook_response');
}
$table->index('hook_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('web_hook_response');
}
}

View File

@ -1,41 +1,40 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateUsersTable extends Migration {
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function(Blueprint $table)
{
$table->increments('id');
$table->string('username', 200)->nullable(false);
$table->string('password')->nullable(false);
$table->rememberToken();
$table->string('email')->nullable()->default(null);
$table->boolean('active')->default(1);
$table->tinyInteger('level')->default(2);
$table->timestamps();
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('username', 200)->nullable(false);
$table->string('password')->nullable(false);
$table->rememberToken();
$table->string('email')->nullable()->default(null);
$table->boolean('active')->default(1);
$table->tinyInteger('level')->default(2);
$table->timestamps();
$table->index('remember_token');
$table->index('active');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('users');
}
$table->index('remember_token');
$table->index('active');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('users');
}
}

View File

@ -1,38 +1,37 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateIncidentTemplatesTable extends Migration {
class CreateIncidentTemplatesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('incident_templates', function(Blueprint $table)
{
$table->increments('id');
$table->string('name')->nullable(false);
$table->string('slug', 50)->nullable(false);
$table->longText('template')->nullable(false);
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('incident_templates', function (Blueprint $table) {
$table->increments('id');
$table->string('name')->nullable(false);
$table->string('slug', 50)->nullable(false);
$table->longText('template')->nullable(false);
$table->timestamps();
$table->timestamps();
$table->index('slug');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('incident_templates');
}
$table->index('slug');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('incident_templates');
}
}

View File

@ -1,36 +1,35 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateMetricsTable extends Migration {
class CreateMetricsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('metrics', function(Blueprint $table)
{
$table->increments('id');
$table->string('name')->nullable(false);
$table->string('suffix')->nullable(false);
$table->string('description')->nullable(false);
$table->boolean('display_chart')->default(false);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('metrics');
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('metrics', function (Blueprint $table) {
$table->increments('id');
$table->string('name')->nullable(false);
$table->string('suffix')->nullable(false);
$table->string('description')->nullable(false);
$table->boolean('display_chart')->default(false);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('metrics');
}
}

View File

@ -1,36 +1,35 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateMetricPointsTable extends Migration {
class CreateMetricPointsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('metric_points', function(Blueprint $table)
{
$table->increments('id');
$table->integer('metric_id')->unsigned();
$table->integer('value')->unsigned();
$table->timestamps();
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('metric_points', function (Blueprint $table) {
$table->increments('id');
$table->integer('metric_id')->unsigned();
$table->integer('value')->unsigned();
$table->timestamps();
$table->foreign('metric_id')->references('id')->on('metrics');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('metric_points');
}
$table->foreign('metric_id')->references('id')->on('metrics');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('metric_points');
}
}

View File

@ -1,36 +1,34 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class UserIdColumnForComponents extends Migration {
class UserIdColumnForComponents extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('components', function(Blueprint $table)
{
$table->unsignedInteger('user_id')->nullable();
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('components', function (Blueprint $table) {
$table->unsignedInteger('user_id')->nullable();
$table->foreign('user_id')->references('id')->on('users')->onDelete('SET NULL')->onUpdate('NO ACTION');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('components', function(Blueprint $table)
{
$table->dropColumn('user_id');
});
}
$table->foreign('user_id')->references('id')->on('users')->onDelete('SET NULL')->onUpdate('NO ACTION');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('components', function (Blueprint $table) {
$table->dropColumn('user_id');
});
}
}

View File

@ -1,36 +1,34 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class UserIdColumnForIncidents extends Migration {
class UserIdColumnForIncidents extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('incidents', function(Blueprint $table)
{
$table->unsignedInteger('user_id')->nullable();
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('incidents', function (Blueprint $table) {
$table->unsignedInteger('user_id')->nullable();
$table->foreign('user_id')->references('id')->on('users')->onDelete('SET NULL')->onUpdate('NO ACTION');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('incidents', function(Blueprint $table)
{
$table->dropColumn('user_id');
});
}
$table->foreign('user_id')->references('id')->on('users')->onDelete('SET NULL')->onUpdate('NO ACTION');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('incidents', function (Blueprint $table) {
$table->dropColumn('user_id');
});
}
}

View File

@ -1,34 +1,33 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateSubscribersTable extends Migration {
class CreateSubscribersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('subscribers', function(Blueprint $table)
{
$table->increments('id');
$table->string('email')->nullable(false);
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('subscribers');
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('subscribers', function (Blueprint $table) {
$table->increments('id');
$table->string('email')->nullable(false);
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('subscribers');
}
}

View File

@ -1,37 +1,36 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateServicesTable extends Migration {
class CreateServicesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('services', function(Blueprint $table)
{
$table->increments('id');
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('services', function (Blueprint $table) {
$table->increments('id');
$table->string('type')->nullable(false);
$table->boolean('active')->default(0); // Inactive by default
$table->text('properties')->nullable(true);
$table->string('type')->nullable(false);
$table->boolean('active')->default(0); // Inactive by default
$table->text('properties')->nullable(true);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('services');
}
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('services');
}
}

View File

@ -1,34 +1,32 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AlterTableIncidentsRenameComponentColumn extends Migration {
class AlterTableIncidentsRenameComponentColumn extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('incidents', function(Blueprint $table)
{
DB::statement("ALTER TABLE `incidents` CHANGE `component` `component_id` TINYINT(4) NOT NULL DEFAULT '1'");
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('incidents', function(Blueprint $table)
{
DB::statement("ALTER TABLE `incidents` CHANGE `component_id` `component` TINYINT(4) NOT NULL DEFAULT '1'");
});
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('incidents', function (Blueprint $table) {
DB::statement("ALTER TABLE `incidents` CHANGE `component` `component_id` TINYINT(4) NOT NULL DEFAULT '1'");
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('incidents', function (Blueprint $table) {
DB::statement("ALTER TABLE `incidents` CHANGE `component_id` `component` TINYINT(4) NOT NULL DEFAULT '1'");
});
}
}

View File

@ -1,35 +1,33 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AlterIncidentsTableMoveUserIdColumn extends Migration {
class AlterIncidentsTableMoveUserIdColumn extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('incidents', function(Blueprint $table)
{
DB::statement('ALTER TABLE `incidents` MODIFY COLUMN `user_id` INT(10) UNSIGNED DEFAULT NULL AFTER `component_id`;');
});
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('incidents', function (Blueprint $table) {
DB::statement('ALTER TABLE `incidents` MODIFY COLUMN `user_id` INT(10) UNSIGNED DEFAULT NULL AFTER `component_id`;');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('incidents', function(Blueprint $table)
{
DB::statement('ALTER TABLE `incidents` MODIFY COLUMN `user_id` INT(10) UNSIGNED DEFAULT NULL AFTER `deleted_at`;');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('incidents', function (Blueprint $table) {
DB::statement('ALTER TABLE `incidents` MODIFY COLUMN `user_id` INT(10) UNSIGNED DEFAULT NULL AFTER `deleted_at`;');
});
}
}

View File

@ -1,34 +1,32 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AlterTableIncidentsRemoveDefaultComponent extends Migration {
class AlterTableIncidentsRemoveDefaultComponent extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('incidents', function(Blueprint $table)
{
DB::statement("ALTER TABLE `incidents` CHANGE `component_id` `component_id` TINYINT(4) NOT NULL DEFAULT '0';");
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('incidents', function(Blueprint $table)
{
DB::statement("ALTER TABLE `incidents` CHANGE `component_id` `component_id` TINYINT(4) NOT NULL DEFAULT '1';");
});
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('incidents', function (Blueprint $table) {
DB::statement("ALTER TABLE `incidents` CHANGE `component_id` `component_id` TINYINT(4) NOT NULL DEFAULT '0';");
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('incidents', function (Blueprint $table) {
DB::statement("ALTER TABLE `incidents` CHANGE `component_id` `component_id` TINYINT(4) NOT NULL DEFAULT '1';");
});
}
}

View File

@ -2,31 +2,30 @@
use Illuminate\Database\Migrations\Migration;
class CreateSessionTable extends Migration {
class CreateSessionTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('sessions', function($t)
{
$t->string('id')->unique();
$t->text('payload');
$t->integer('last_activity');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('sessions');
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('sessions', function ($t) {
$t->string('id')->unique();
$t->text('payload');
$t->integer('last_activity');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('sessions');
}
}

View File

@ -1,28 +1,29 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AlterTableComponentsAddDeletedAt extends Migration {
class AlterTableComponentsAddDeletedAt extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up() {
Schema::table('components', function(Blueprint $table) {
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('components', function (Blueprint $table) {
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}

View File

@ -1,38 +1,39 @@
<?php
class ComponentTableSeeder extends Seeder {
class ComponentTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Eloquent::unguard();
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Eloquent::unguard();
$defaultComponents = [
[
"name" => "API",
"description" => "Used by third-parties to connect to us",
"status" => 1,
"user_id" => 1
], [
"name" => "Payments",
"description" => "Backed by Stripe",
"status" => 1,
"user_id" => 1
], [
"name" => "Website",
"status" => 1,
"user_id" => 1
]
];
$defaultComponents = [
[
"name" => "API",
"description" => "Used by third-parties to connect to us",
"status" => 1,
"user_id" => 1,
], [
"name" => "Payments",
"description" => "Backed by Stripe",
"status" => 1,
"user_id" => 1
], [
"name" => "Website",
"status" => 1,
"user_id" => 1
],
];
Component::truncate();
Component::truncate();
foreach($defaultComponents as $component) {
Component::create($component);
}
}
foreach ($defaultComponents as $component) {
Component::create($component);
}
}
}

View File

@ -1,19 +1,19 @@
<?php
class DatabaseSeeder extends Seeder {
class DatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Eloquent::unguard();
$this->call('SettingsTableSeeder');
$this->call('IncidentTableSeeder');
$this->call('ComponentTableSeeder');
}
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Eloquent::unguard();
$this->call('SettingsTableSeeder');
$this->call('IncidentTableSeeder');
$this->call('ComponentTableSeeder');
}
}

View File

@ -1,50 +1,51 @@
<?php
class IncidentTableSeeder extends Seeder {
class IncidentTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Eloquent::unguard();
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Eloquent::unguard();
$defaultIncidents = [
[
"name" => "Test Incident",
"message" => "Something went wrong, oh noes.",
"component_id" => 1,
"user_id" => 1,
],
[
"name" => "Update",
"message" => "We've found the problem, so we're looking at it.",
"status" => 2,
"component_id" => 1,
"user_id" => 1,
],
[
"name" => "Monitoring the fix",
"message" => "We're checking that our fix will first work.",
"status" => 3,
"component_id" => 1,
"user_id" => 1,
],
[
"name" => "Awesome",
"message" => "We totally nailed the fix.",
"status" => 4,
"component_id" => 2,
"user_id" => 1,
]
];
$defaultIncidents = [
[
"name" => "Test Incident",
"message" => "Something went wrong, oh noes.",
"component_id" => 1,
"user_id" => 1,
],
[
"name" => "Update",
"message" => "We've found the problem, so we're looking at it.",
"status" => 2,
"component_id" => 1,
"user_id" => 1,
],
[
"name" => "Monitoring the fix",
"message" => "We're checking that our fix will first work.",
"status" => 3,
"component_id" => 1,
"user_id" => 1,
],
[
"name" => "Awesome",
"message" => "We totally nailed the fix.",
"status" => 4,
"component_id" => 2,
"user_id" => 1,
],
];
Incident::truncate();
Incident::truncate();
foreach($defaultIncidents as $incident) {
Incident::create($incident);
}
}
foreach ($defaultIncidents as $incident) {
Incident::create($incident);
}
}
}

View File

@ -1,27 +1,28 @@
<?php
class SettingsTableSeeder extends Seeder {
class SettingsTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Eloquent::unguard();
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Eloquent::unguard();
$defaultSettings = [
[
"name" => "site_name",
"value" => "Test"
]
];
$defaultSettings = [
[
"name" => "site_name",
"value" => "Test",
],
];
Setting::truncate();
Setting::truncate();
foreach($defaultSettings as $setting) {
Setting::create($setting);
}
}
foreach ($defaultSettings as $setting) {
Setting::create($setting);
}
}
}

View File

@ -16,7 +16,7 @@ Route::filter('allowed_domains', 'AllowedDomainsFilter');
|
*/
Route::filter('auth', function() {
Route::filter('auth', function () {
if (Auth::guest()) {
if (Request::ajax()) {
return Response::make('Unauthorized', 401);
@ -26,8 +26,7 @@ Route::filter('auth', function() {
}
});
Route::filter('auth.basic', function() {
Route::filter('auth.basic', function () {
return Auth::basic();
});
@ -42,7 +41,7 @@ Route::filter('auth.basic', function() {
|
*/
Route::filter('guest', function() {
Route::filter('guest', function () {
if (Auth::check()) {
return Redirect::to('/');
}
@ -59,8 +58,8 @@ Route::filter('guest', function() {
|
*/
Route::filter('csrf', function() {
Route::filter('csrf', function () {
if (Session::token() !== Input::get('_token')) {
throw new Illuminate\Session\TokenMismatchException;
throw new Illuminate\Session\TokenMismatchException();
}
});

View File

@ -1,18 +1,20 @@
<?php
class AllowedDomainsFilter {
public function filter($route, $request, $response) {
// Always allow our own domain.
$ourDomain = Setting::get('app_domain');
class AllowedDomainsFilter
{
public function filter($route, $request, $response)
{
// Always allow our own domain.
$ourDomain = Setting::get('app_domain');
$response->headers->set('Access-Control-Allow-Origin', $ourDomain);
// Should we allow anyone else?
if ($setting = Setting::get('allowed_domains')) {
$domains = explode(',', $setting);
foreach ($domains as $domain) {
$response->headers->set('Access-Control-Allow-Origin', $domain);
}
}
if ($setting = Setting::get('allowed_domains')) {
$domains = explode(',', $setting);
foreach ($domains as $domain) {
$response->headers->set('Access-Control-Allow-Origin', $domain);
}
}
return $response;
}

View File

@ -1,8 +1,11 @@
<?php
class CORSFilter {
public function filter($route, $request, $response) {
class CORSFilter
{
public function filter($route, $request, $response)
{
$response->headers->set('Access-Control-Allow-Origin', '*');
return $response;
}
}

View File

@ -1,7 +1,9 @@
<?php
class HasSettingFilter {
public function filter($route, $request, $settingName) {
class HasSettingFilter
{
public function filter($route, $request, $settingName)
{
try {
$setting = Setting::where('name', $settingName)->first();
if (!$setting->value) {

View File

@ -1,7 +1,9 @@
<?php
class IsSetupFilter {
public function filter($route, $request) {
class IsSetupFilter
{
public function filter($route, $request)
{
try {
$setting = Setting::where('name', 'app_name')->first();
if ($setting->value) {

View File

@ -1,28 +1,24 @@
<?php
if ( ! function_exists('elixir'))
{
if (! function_exists('elixir')) {
/**
* Get the path to a versioned Elixir file.
*
* @param string $file
* @return string
*/
* Get the path to a versioned Elixir file.
*
* @param string $file
* @return string
*/
function elixir($file)
{
static $manifest = null;
if (is_null($manifest))
{
if (is_null($manifest)) {
$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];
}
throw new InvalidArgumentException("File {$file} not defined in asset manifest.");
}
}

View File

@ -1,47 +1,47 @@
<?php
return array(
return [
// Components
'component' => array(
'status' => array(
'component' => [
'status' => [
1 => 'Operational',
2 => 'Performance Issues',
3 => 'Partial Outage',
4 => 'Major Outage'
)
),
4 => 'Major Outage',
],
],
// Incidents
'incident' => array(
'status' => array(
'incident' => [
'status' => [
1 => 'Investigating',
2 => 'Identified',
3 => 'Watching',
4 => 'Fixed'
)
),
4 => 'Fixed',
],
],
// Service Status
'service' => array(
'service' => [
'good' => 'All systems are functional.',
'bad' => 'Some systems are experiencing issues.',
),
'bad' => 'Some systems are experiencing issues.',
],
// Other
'powered_by' => ':app Status Page is powered by <a href="https://cachethq.github.io">Cachet</a>.',
'logout' => 'Logout',
'logged_in' => 'You\'re logged in.',
'setup' => 'Setup Cachet',
'dashboard' => array(
'dashboard' => 'Dashboard',
'components' => 'Components',
'component-add' => 'Add Component',
'incidents' => 'Incidents',
'incident-add' => 'Add Incident',
'logout' => 'Logout',
'logged_in' => 'You\'re logged in.',
'setup' => 'Setup Cachet',
'dashboard' => [
'dashboard' => 'Dashboard',
'components' => 'Components',
'component-add' => 'Add Component',
'incidents' => 'Incidents',
'incident-add' => 'Add Incident',
'incident-create-template' => 'Create Template',
'metrics' => 'Metrics',
'metrics-add' => 'Add Metric Point',
'status_page' => 'Status Page',
'settings' => 'Settings',
'notifications' => 'Notifications',
'toggle_navigation' => 'Toggle Navigation',
'search' => 'Search...',
),
);
'metrics' => 'Metrics',
'metrics-add' => 'Add Metric Point',
'status_page' => 'Status Page',
'settings' => 'Settings',
'notifications' => 'Notifications',
'toggle_navigation' => 'Toggle Navigation',
'search' => 'Search...',
],
];

View File

@ -1,20 +1,20 @@
<?php
return array(
return [
/*
|--------------------------------------------------------------------------
| Pagination Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used by the paginator library to build
| the simple pagination links. You are free to change them to anything
| you want to customize your views to better match your application.
|
*/
/*
|--------------------------------------------------------------------------
| Pagination Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used by the paginator library to build
| the simple pagination links. You are free to change them to anything
| you want to customize your views to better match your application.
|
*/
'previous' => '&laquo; Previous',
'previous' => '&laquo; Previous',
'next' => 'Next &raquo;',
'next' => 'Next &raquo;',
);
];

View File

@ -1,26 +1,26 @@
<?php
return array(
return [
/*
|--------------------------------------------------------------------------
| Password Reminder Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are the default lines which match reasons
| that are given by the password broker for a password update attempt
| has failed, such as for an invalid token or invalid new password.
|
*/
/*
|--------------------------------------------------------------------------
| Password Reminder Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are the default lines which match reasons
| that are given by the password broker for a password update attempt
| has failed, such as for an invalid token or invalid new password.
|
*/
"password" => "Passwords must be at least six characters and match the confirmation.",
"password" => "Passwords must be at least six characters and match the confirmation.",
"user" => "We can't find a user with that e-mail address.",
"user" => "We can't find a user with that e-mail address.",
"token" => "This password reset token is invalid.",
"token" => "This password reset token is invalid.",
"sent" => "Password reminder sent!",
"sent" => "Password reminder sent!",
"reset" => "Password has been reset!",
"reset" => "Password has been reset!",
);
];

View File

@ -1,106 +1,106 @@
<?php
return array(
return [
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
| the validator class. Some of these rules have multiple versions such
| as the size rules. Feel free to tweak each of these messages here.
|
*/
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
| the validator class. Some of these rules have multiple versions such
| as the size rules. Feel free to tweak each of these messages here.
|
*/
"accepted" => "The :attribute must be accepted.",
"active_url" => "The :attribute is not a valid URL.",
"after" => "The :attribute must be a date after :date.",
"alpha" => "The :attribute may only contain letters.",
"alpha_dash" => "The :attribute may only contain letters, numbers, and dashes.",
"alpha_num" => "The :attribute may only contain letters and numbers.",
"array" => "The :attribute must be an array.",
"before" => "The :attribute must be a date before :date.",
"between" => array(
"numeric" => "The :attribute must be between :min and :max.",
"file" => "The :attribute must be between :min and :max kilobytes.",
"string" => "The :attribute must be between :min and :max characters.",
"array" => "The :attribute must have between :min and :max items.",
),
"boolean" => "The :attribute field must be true or false.",
"confirmed" => "The :attribute confirmation does not match.",
"date" => "The :attribute is not a valid date.",
"date_format" => "The :attribute does not match the format :format.",
"different" => "The :attribute and :other must be different.",
"digits" => "The :attribute must be :digits digits.",
"digits_between" => "The :attribute must be between :min and :max digits.",
"email" => "The :attribute must be a valid email address.",
"exists" => "The selected :attribute is invalid.",
"image" => "The :attribute must be an image.",
"in" => "The selected :attribute is invalid.",
"integer" => "The :attribute must be an integer.",
"ip" => "The :attribute must be a valid IP address.",
"max" => array(
"numeric" => "The :attribute may not be greater than :max.",
"file" => "The :attribute may not be greater than :max kilobytes.",
"string" => "The :attribute may not be greater than :max characters.",
"array" => "The :attribute may not have more than :max items.",
),
"mimes" => "The :attribute must be a file of type: :values.",
"min" => array(
"numeric" => "The :attribute must be at least :min.",
"file" => "The :attribute must be at least :min kilobytes.",
"string" => "The :attribute must be at least :min characters.",
"array" => "The :attribute must have at least :min items.",
),
"not_in" => "The selected :attribute is invalid.",
"numeric" => "The :attribute must be a number.",
"regex" => "The :attribute format is invalid.",
"required" => "The :attribute field is required.",
"required_if" => "The :attribute field is required when :other is :value.",
"required_with" => "The :attribute field is required when :values is present.",
"required_with_all" => "The :attribute field is required when :values is 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.",
"same" => "The :attribute and :other must match.",
"size" => array(
"numeric" => "The :attribute must be :size.",
"file" => "The :attribute must be :size kilobytes.",
"string" => "The :attribute must be :size characters.",
"array" => "The :attribute must contain :size items.",
),
"unique" => "The :attribute has already been taken.",
"url" => "The :attribute format is invalid.",
"timezone" => "The :attribute must be a valid zone.",
"accepted" => "The :attribute must be accepted.",
"active_url" => "The :attribute is not a valid URL.",
"after" => "The :attribute must be a date after :date.",
"alpha" => "The :attribute may only contain letters.",
"alpha_dash" => "The :attribute may only contain letters, numbers, and dashes.",
"alpha_num" => "The :attribute may only contain letters and numbers.",
"array" => "The :attribute must be an array.",
"before" => "The :attribute must be a date before :date.",
"between" => [
"numeric" => "The :attribute must be between :min and :max.",
"file" => "The :attribute must be between :min and :max kilobytes.",
"string" => "The :attribute must be between :min and :max characters.",
"array" => "The :attribute must have between :min and :max items.",
],
"boolean" => "The :attribute field must be true or false.",
"confirmed" => "The :attribute confirmation does not match.",
"date" => "The :attribute is not a valid date.",
"date_format" => "The :attribute does not match the format :format.",
"different" => "The :attribute and :other must be different.",
"digits" => "The :attribute must be :digits digits.",
"digits_between" => "The :attribute must be between :min and :max digits.",
"email" => "The :attribute must be a valid email address.",
"exists" => "The selected :attribute is invalid.",
"image" => "The :attribute must be an image.",
"in" => "The selected :attribute is invalid.",
"integer" => "The :attribute must be an integer.",
"ip" => "The :attribute must be a valid IP address.",
"max" => [
"numeric" => "The :attribute may not be greater than :max.",
"file" => "The :attribute may not be greater than :max kilobytes.",
"string" => "The :attribute may not be greater than :max characters.",
"array" => "The :attribute may not have more than :max items.",
],
"mimes" => "The :attribute must be a file of type: :values.",
"min" => [
"numeric" => "The :attribute must be at least :min.",
"file" => "The :attribute must be at least :min kilobytes.",
"string" => "The :attribute must be at least :min characters.",
"array" => "The :attribute must have at least :min items.",
],
"not_in" => "The selected :attribute is invalid.",
"numeric" => "The :attribute must be a number.",
"regex" => "The :attribute format is invalid.",
"required" => "The :attribute field is required.",
"required_if" => "The :attribute field is required when :other is :value.",
"required_with" => "The :attribute field is required when :values is present.",
"required_with_all" => "The :attribute field is required when :values is 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.",
"same" => "The :attribute and :other must match.",
"size" => [
"numeric" => "The :attribute must be :size.",
"file" => "The :attribute must be :size kilobytes.",
"string" => "The :attribute must be :size characters.",
"array" => "The :attribute must contain :size items.",
],
"unique" => "The :attribute has already been taken.",
"url" => "The :attribute format is invalid.",
"timezone" => "The :attribute must be a valid zone.",
/*
|--------------------------------------------------------------------------
| Custom Validation Language Lines
|--------------------------------------------------------------------------
|
| Here you may specify custom validation messages for attributes using the
| convention "attribute.rule" to name the lines. This makes it quick to
| specify a specific custom language line for a given attribute rule.
|
*/
/*
|--------------------------------------------------------------------------
| Custom Validation Language Lines
|--------------------------------------------------------------------------
|
| Here you may specify custom validation messages for attributes using the
| convention "attribute.rule" to name the lines. This makes it quick to
| specify a specific custom language line for a given attribute rule.
|
*/
'custom' => array(
'attribute-name' => array(
'rule-name' => 'custom-message',
),
),
'custom' => [
'attribute-name' => [
'rule-name' => 'custom-message',
],
],
/*
|--------------------------------------------------------------------------
| Custom Validation Attributes
|--------------------------------------------------------------------------
|
| The following language lines are used to swap attribute place-holders
| with something more reader friendly such as E-Mail Address instead
| of "email". This simply helps us make messages a little cleaner.
|
*/
/*
|--------------------------------------------------------------------------
| Custom Validation Attributes
|--------------------------------------------------------------------------
|
| The following language lines are used to swap attribute place-holders
| with something more reader friendly such as E-Mail Address instead
| of "email". This simply helps us make messages a little cleaner.
|
*/
'attributes' => array(),
'attributes' => [],
);
];

View File

@ -2,14 +2,15 @@
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 Illuminate\Database\Eloquent\SoftDeletingTrait;
protected $rules = [
'user_id' => 'integer|required',
'name' => 'required',
'status' => 'integer'
'status' => 'integer',
];
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.
* @return Illuminate\Database\Eloquent\Relations
*/
public function incidents() {
public function incidents()
{
return $this->hasMany('Incident', 'component_id', 'id');
}
@ -26,15 +28,17 @@ class Component extends Eloquent implements \Dingo\Api\Transformer\Transformable
* Looks up the human readable version of the status.
* @return string
*/
public function getHumanStatusAttribute() {
return Lang::get('cachet.component.status.' . $this->status);
public function getHumanStatusAttribute()
{
return Lang::get('cachet.component.status.'.$this->status);
}
/**
* Get the transformer instance.
* @return ComponentTransformer
*/
public function getTransformer() {
public function getTransformer()
{
return new CachetHQ\Cachet\Transformers\ComponentTransformer();
}
}

View File

@ -2,7 +2,8 @@
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 Illuminate\Database\Eloquent\SoftDeletingTrait;
@ -22,7 +23,8 @@ class Incident extends Eloquent implements \Dingo\Api\Transformer\TransformableI
* An incident belongs to a component.
* @return Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function component() {
public function component()
{
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.
* @return string
*/
public function getHumanStatusAttribute() {
public function getHumanStatusAttribute()
{
$statuses = Lang::get('cachet.incident.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.
* @return string
*/
public function getIconAttribute() {
public function getIconAttribute()
{
switch ($this->status) {
case 1: return 'fa fa-flag';
case 2: return 'fa fa-warning';
@ -52,7 +57,8 @@ class Incident extends Eloquent implements \Dingo\Api\Transformer\TransformableI
* Get the transformer instance.
* @return CachetHQ\Cachet\Transformers\IncidentTransformer
*/
public function getTransformer() {
public function getTransformer()
{
return new CachetHQ\Cachet\Transformers\IncidentTransformer();
}
}

View File

@ -2,7 +2,8 @@
use Watson\Validating\ValidatingTrait;
class IncidentTemplate extends Eloquent {
class IncidentTemplate extends Eloquent
{
use ValidatingTrait;
protected $rules = [
@ -19,10 +20,11 @@ class IncidentTemplate extends Eloquent {
* Overrides the models boot method.
* @return void
*/
public static function boot() {
public static function boot()
{
parent::boot();
self::saving(function($template) {
self::saving(function ($template) {
$template->slug = Str::slug($template->name);
});
}

View File

@ -2,7 +2,8 @@
use Watson\Validating\ValidatingTrait;
class Metric extends Eloquent implements \Dingo\Api\Transformer\TransformableInterface {
class Metric extends Eloquent implements \Dingo\Api\Transformer\TransformableInterface
{
use ValidatingTrait;
protected $rules = [
@ -17,7 +18,8 @@ class Metric extends Eloquent implements \Dingo\Api\Transformer\TransformableInt
* Metrics contain many metric points.
* @return Illuminate\Database\Eloquent\Builder
*/
public function points() {
public function points()
{
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.
* @return bool
*/
public function getShouldDisplayAttribute() {
public function getShouldDisplayAttribute()
{
return $this->display_chart === 1;
}
@ -33,7 +36,8 @@ class Metric extends Eloquent implements \Dingo\Api\Transformer\TransformableInt
* Get the transformer instance.
* @return CachetHQ\Cachet\Transformers\MetricTransformer
*/
public function getTransformer() {
public function getTransformer()
{
return new CachetHQ\Cachet\Transformers\MetricTransformer();
}
}

View File

@ -1,11 +1,13 @@
<?php
class MetricPoint extends Eloquent {
class MetricPoint extends Eloquent
{
/**
* A metric point belongs to a metric unit.
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function metric() {
public function metric()
{
return $this->belongsTo('Metric', 'id', 'metric_id');
}
}

View File

@ -2,13 +2,14 @@
use Watson\Validating\ValidatingTrait;
class Service extends Eloquent {
class Service extends Eloquent
{
use ValidatingTrait;
protected $rules = [
'type' => 'alpha_dash|required',
'active' => 'required|in:0,1',
'properties' => ''
'properties' => '',
];
/**
@ -16,7 +17,8 @@ class Service extends Eloquent {
* @param string $properties
* @return object
*/
public function getPropertiesAttribute($properties) {
public function getPropertiesAttribute($properties)
{
return json_decode($properties);
}
@ -24,7 +26,8 @@ class Service extends Eloquent {
* Sets the properties attribute which auto encodes to a JSON string.
* @param mixed $properties
*/
public function setPropertiesAttribute($properties) {
public function setPropertiesAttribute($properties)
{
$this->attributes['properties'] = json_encode($properties);
}
}

View File

@ -1,15 +1,17 @@
<?php
class Setting extends Eloquent {
class Setting extends Eloquent
{
protected $fillable = ['name', 'value'];
/**
* Returns a setting from the database.
* @param string $settingName
* @param bool $checkEnv
* @param bool $checkEnv
* @return string
*/
public static function get($settingName, $checkEnv = true) {
public static function get($settingName, $checkEnv = true)
{
// Default setting value.
$setting = null;
@ -32,11 +34,12 @@ class Setting extends Eloquent {
/**
* Throws an Exception
* @param string $setting
* @param string $setting
* @throws Exception
* @return void
*/
public static function unknownSettingException($setting) {
public static function unknownSettingException($setting)
{
throw new \Exception(
sprintf('Unknown setting %s', $setting)
);

View File

@ -1,14 +1,15 @@
<?php
use Watson\Validating\ValidatingTrait;
use Illuminate\Database\Eloquent\SoftDeletingTrait;
use Watson\Validating\ValidatingTrait;
class Subscriber extends Eloquent {
class Subscriber extends Eloquent
{
use ValidatingTrait;
use SoftDeletingTrait;
protected $rules = [
'email' => 'required|email'
'email' => 'required|email',
];
protected $fillable = ['email'];

View File

@ -1,11 +1,12 @@
<?php
use Illuminate\Auth\UserTrait;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableTrait;
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;
/**
@ -32,7 +33,8 @@ class User extends Eloquent implements UserInterface, RemindableInterface {
* @param string @password
* @return void
*/
public function setPasswordAttribute($password) {
public function setPasswordAttribute($password)
{
$this->attributes['password'] = Hash::make($password);
}
@ -41,12 +43,12 @@ class User extends Eloquent implements UserInterface, RemindableInterface {
* @param integer $size
* @return string
*/
public function getGravatarAttribute($size = 200) {
public function getGravatarAttribute($size = 200)
{
return sprintf(
'https://www.gravatar.com/avatar/%s?size=%d',
md5($this->email),
$size
);
}
}

View File

@ -1,6 +1,7 @@
<?php
class WebHook extends Eloquent {
class WebHook extends Eloquent
{
// Request Methods.
const HEAD = 0;
const GET = 1;
@ -11,9 +12,10 @@ class WebHook extends Eloquent {
/**
* 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');
}
@ -22,7 +24,8 @@ class WebHook extends Eloquent {
* @param Illuminate\Database\Eloquent\Builder $query
* @return Illuminate\Database\Eloquent\Builder
*/
public function scopeActive($query) {
public function scopeActive($query)
{
return $query->where('active', 1);
}
@ -30,17 +33,19 @@ class WebHook extends Eloquent {
* Setups a Ping event that is fired upon a web hook.
* @return array result of the ping
*/
public function ping() {
public function ping()
{
return $this->fire('ping', 'Coming live to you from Cachet.');
}
/**
* Fires the actual web hook event.
* @param string $eventType the event to send X-Cachet-Event
* @param mixed $data Data to send to the Web Hook
* @param string $eventType the event to send X-Cachet-Event
* @param mixed $data Data to send to the Web Hook
* @return object
*/
public function fire($eventType, $data = null) {
public function fire($eventType, $data = null)
{
$startTime = microtime(true);
$client = new \GuzzleHttp\Client();
@ -58,10 +63,10 @@ class WebHook extends Eloquent {
$response = $e->getResponse();
}
$timeTaken = microtime(TRUE) - $startTime;
$timeTaken = microtime(true) - $startTime;
// Store the request
$hookResponse = new WebHookResponse;
$hookResponse = new WebHookResponse();
$hookResponse->web_hook_id = $this->id;
$hookResponse->response_code = $response->getStatusCode();
$hookResponse->sent_headers = json_encode($request->getHeaders());
@ -77,10 +82,11 @@ class WebHook extends Eloquent {
/**
* Returns a human readable request type name.
* @throws Exception
* @return string HEAD, GET, POST, DELETE, PATCH, PUT etc
* @return string HEAD, GET, POST, DELETE, PATCH, PUT etc
*/
public function getRequestMethodAttribute() {
$requestMethod = NULL;
public function getRequestMethodAttribute()
{
$requestMethod = null;
switch ($this->request_type) {
case self::HEAD:
@ -103,7 +109,7 @@ class WebHook extends Eloquent {
break;
default:
throw new Exception('Unknown request type value: ' . $this->request_type);
throw new Exception('Unknown request type value: '.$this->request_type);
break;
}

View File

@ -1,11 +1,13 @@
<?php
class WebHookResponse extends Eloquent {
/**
* Returns the hook that a response belongs to.
* @return Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function hook() {
class WebHookResponse extends Eloquent
{
/**
* Returns the hook that a response belongs to.
* @return Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function hook()
{
return $this->belongsTo('WebHook', 'id', 'hook_id');
}
}

View File

@ -3,8 +3,8 @@
Route::api([
'version' => 'v1',
'namespace' => 'CachetHQ\Cachet\Controllers\Api',
'after' => 'allowed_domains'
], function() {
'after' => 'allowed_domains',
], function () {
Route::get('components', 'ComponentController@getComponents');
Route::get('components/{id}', 'ComponentController@getComponent');
Route::get('components/{id}/incidents', 'ComponentController@getComponentIncidents');
@ -14,7 +14,7 @@ Route::api([
Route::get('metrics/{id}', 'MetricController@getMetric');
Route::get('metrics/points/{id}', 'MetricPointController@getMetricPoint');
Route::group(['protected' => true], function() {
Route::group(['protected' => true], function () {
Route::post('components', 'ComponentController@postComponents');
Route::post('incidents', 'IncidentController@postIncidents');
Route::post('metrics', 'MetricController@postMetrics');

View File

@ -1,13 +1,13 @@
<?php
// Prevent access until the app is setup.
Route::group(['before' => 'has_setting:app_name'], function() {
Route::group(['before' => 'has_setting:app_name'], function () {
Route::get('/', ['as' => 'status-page', 'uses' => 'HomeController@showIndex']);
Route::get('/incident/{incident}', 'HomeController@showIncident');
});
// Setup route.
Route::group(['before' => 'is_setup'], function() {
Route::group(['before' => 'is_setup'], function () {
Route::controller('/setup', 'SetupController');
});

View File

@ -1,8 +1,8 @@
<?php
Route::group(['before' => 'has_setting:app_name'], function() {
Route::group(['before' => 'has_setting:app_name'], function () {
Route::get('/auth/login', ['before' => 'guest', 'as' => 'login', 'uses' => 'AuthController@showLogin']);
Route::post('/auth/login', ['before' => 'guest|csrf', 'as' => 'logout', 'uses' => 'AuthController@postLogin']);
});
Route::get('/auth/logout', ['before' => 'auth', 'as' => 'logout', 'uses' => 'AuthController@logoutAction']);
Route::get('/auth/logout', ['before' => 'auth', 'as' => 'logout', 'uses' => 'AuthController@logoutAction']);

View File

@ -1,6 +1,6 @@
<?php
Route::group(['before' => 'auth', 'prefix' => 'dashboard'], function() {
Route::group(['before' => 'auth', 'prefix' => 'dashboard'], function () {
// Dashboard
Route::get('/', ['as' => 'dashboard', 'uses' => 'DashboardController@showDashboard']);

View File

@ -10,4 +10,3 @@
| the console gets access to each of the command object instances.
|
*/

View File

@ -11,16 +11,16 @@
|
*/
ClassLoader::addDirectories(array(
ClassLoader::addDirectories([
app_path().'/commands',
app_path().'/controllers',
app_path().'/models',
app_path().'/transformers',
app_path().'/database/seeds',
app_path().'/filters',
app_path().'/commands',
app_path().'/controllers',
app_path().'/models',
app_path().'/transformers',
app_path().'/database/seeds',
app_path().'/filters',
));
]);
/*
|--------------------------------------------------------------------------
@ -48,17 +48,16 @@ Log::useFiles(storage_path().'/logs/laravel.log');
|
*/
App::error(function(Exception $exception, $code)
{
Log::error($exception);
App::error(function (Exception $exception, $code) {
Log::error($exception);
});
API::error(function (\Illuminate\Database\Eloquent\ModelNotFoundException $exception) {
return Response::make(['error' => $exception->getMessage()], 404);
return Response::make(['error' => $exception->getMessage()], 404);
});
App::missing(function($exception) {
return Response::view('errors.404', array(), 404);
App::missing(function ($exception) {
return Response::view('errors.404', [], 404);
});
/*
@ -72,9 +71,8 @@ App::missing(function($exception) {
|
*/
App::down(function()
{
return Response::make("Be right back!", 503);
App::down(function () {
return Response::make("Be right back!", 503);
});
/*

View File

@ -1,3 +1,3 @@
<?php
//
//

View File

@ -1,32 +1,36 @@
<?php
class ComponentControllerTest extends TestCase {
class ComponentControllerTest extends TestCase
{
public function setUp() {
$this->repo = Mockery::mock('CachetHQ\Cachet\Repositories\Component\ComponentRepository');
$this->dingo = Mockery::mock('Dingo\Api\Auth\Shield');
}
public function setUp()
{
$this->repo = Mockery::mock('CachetHQ\Cachet\Repositories\Component\ComponentRepository');
$this->dingo = Mockery::mock('Dingo\Api\Auth\Shield');
}
public function tearDown() {
Mockery::close();
}
public function tearDown()
{
Mockery::close();
}
public function test_get_components_method() {
$this->repo->shouldReceive('all')->once()->andReturn('foo');
public function test_get_components_method()
{
$this->repo->shouldReceive('all')->once()->andReturn('foo');
$controller = new CachetHQ\Cachet\Controllers\Api\ComponentController($this->repo);
$response = $controller->getComponents();
$controller = new CachetHQ\Cachet\Controllers\Api\ComponentController($this->repo);
$response = $controller->getComponents();
$this->assertEquals('foo', $response);
}
$this->assertEquals('foo', $response);
}
public function test_get_component_method() {
$this->repo->shouldReceive('findOrFail')->with(1)->once()->andReturn('foo');
public function test_get_component_method()
{
$this->repo->shouldReceive('findOrFail')->with(1)->once()->andReturn('foo');
$controller = new CachetHQ\Cachet\Controllers\Api\ComponentController($this->repo);
$response = $controller->getComponent(1);
$controller = new CachetHQ\Cachet\Controllers\Api\ComponentController($this->repo);
$response = $controller->getComponent(1);
$this->assertEquals('foo', $response);
}
$this->assertEquals('foo', $response);
}
}

View File

@ -1,18 +1,19 @@
<?php
class TestCase extends Illuminate\Foundation\Testing\TestCase {
class TestCase extends Illuminate\Foundation\Testing\TestCase
{
/**
* Creates the application.
*
* @return \Symfony\Component\HttpKernel\HttpKernelInterface
*/
public function createApplication()
{
$unitTesting = true;
/**
* Creates the application.
*
* @return \Symfony\Component\HttpKernel\HttpKernelInterface
*/
public function createApplication()
{
$unitTesting = true;
$testEnvironment = 'testing';
$testEnvironment = 'testing';
return require __DIR__.'/../../bootstrap/start.php';
}
}
return require __DIR__.'/../../bootstrap/start.php';
}
}

View File

@ -1,9 +1,9 @@
<?php
View::composer('index', function($view) {
View::composer('index', function ($view) {
$date = date('Y-m-d');
$incidents = Incident::whereRaw('DATE(created_at) = "' . $date . '"')
$incidents = Incident::whereRaw('DATE(created_at) = "'.$date.'"')
->groupBy('status')
->orderBy('status', 'desc');
@ -19,6 +19,6 @@ View::composer('index', function($view) {
$view->with([
'systemStatus' => $status,
'systemMessage' => $message
'systemMessage' => $message,
]);
});

View File

@ -27,9 +27,8 @@ require __DIR__.'/../vendor/autoload.php';
|
*/
if (file_exists($compiled = __DIR__.'/compiled.php'))
{
require $compiled;
if (file_exists($compiled = __DIR__.'/compiled.php')) {
require $compiled;
}
/*
@ -69,7 +68,6 @@ Illuminate\Support\ClassLoader::register();
|
*/
if (is_dir($workbench = __DIR__.'/../workbench'))
{
Illuminate\Workbench\Starter::start($workbench);
if (is_dir($workbench = __DIR__.'/../workbench')) {
Illuminate\Workbench\Starter::start($workbench);
}

Some files were not shown because too many files have changed in this diff Show More