mirror of
https://github.com/CachetHQ/Cachet.git
synced 2025-04-20 07:22:05 +02:00
Namespaced models and refactored filters
This commit is contained in:
parent
15a6694865
commit
0ccb5e289c
@ -157,17 +157,16 @@ return [
|
||||
|
||||
'aliases' => [
|
||||
|
||||
'API' => 'Dingo\Api\Facade\API',
|
||||
'App' => 'Illuminate\Support\Facades\App',
|
||||
'Auth' => 'Illuminate\Support\Facades\Auth',
|
||||
'Form' => 'Illuminate\Support\Facades\Form',
|
||||
'HTML' => 'Illuminate\Support\Facades\HTML',
|
||||
'Input' => 'Illuminate\Support\Facades\Input',
|
||||
'Redirect' => 'Illuminate\Support\Facades\Redirect',
|
||||
'Request' => 'Illuminate\Support\Facades\Request',
|
||||
'Response' => 'Illuminate\Support\Facades\Response',
|
||||
'Route' => 'Illuminate\Support\Facades\Route',
|
||||
'Session' => 'Illuminate\Support\Facades\Session',
|
||||
'Setting' => 'CachetHQ\Cachet\Models\Setting',
|
||||
'Str' => 'Illuminate\Support\Str',
|
||||
|
||||
],
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use CachetHQ\Cachet\Models\Incident;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use CachetHQ\Cachet\Models\Setting;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use CachetHQ\Cachet\Models\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
|
@ -1,66 +0,0 @@
|
||||
<?php
|
||||
|
||||
Route::filter('is_setup', 'IsSetupFilter');
|
||||
Route::filter('has_setting', 'HasSettingFilter');
|
||||
Route::filter('cors', 'CORSFilter');
|
||||
Route::filter('allowed_domains', 'AllowedDomainsFilter');
|
||||
Route::filter('login_throttling', 'LoginThrottlingFilter');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Filters
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following filters are used to verify that the user of the current
|
||||
| session is logged into this application. The "basic" filter easily
|
||||
| integrates HTTP Basic authentication for quick, simple checking.
|
||||
|
|
||||
*/
|
||||
|
||||
Route::filter('auth', function () {
|
||||
if (Auth::guest()) {
|
||||
if (Request::ajax()) {
|
||||
return Response::make('Unauthorized', 401);
|
||||
} else {
|
||||
return Redirect::guest('auth/login');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Route::filter('auth.basic', function () {
|
||||
return Auth::basic();
|
||||
});
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Guest Filter
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The "guest" filter is the counterpart of the authentication filters as
|
||||
| it simply checks that the current user is not logged in. A redirect
|
||||
| response will be issued if they are, which you may freely change.
|
||||
|
|
||||
*/
|
||||
|
||||
Route::filter('guest', function () {
|
||||
if (Auth::check()) {
|
||||
return Redirect::to('/');
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| CSRF Protection Filter
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The CSRF filter is responsible for protecting your application against
|
||||
| cross-site request forgery attacks. If this special token in a user
|
||||
| session does not match the one given in this request, we'll bail.
|
||||
|
|
||||
*/
|
||||
|
||||
Route::filter('csrf', function () {
|
||||
if (Session::token() !== Input::get('_token')) {
|
||||
throw new Illuminate\Session\TokenMismatchException();
|
||||
}
|
||||
});
|
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
class CORSFilter
|
||||
{
|
||||
public function filter($route, $request, $response)
|
||||
{
|
||||
$response->headers->set('Access-Control-Allow-Origin', '*');
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
Route::model('component', 'Component');
|
||||
Route::model('incident', 'Incident');
|
||||
Route::model('incident_template', 'IncidentTemplate');
|
||||
Route::model('setting', 'Setting');
|
||||
// Route::model('webhook', 'WebHook');
|
||||
Route::model('user', 'User');
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
Route::api(['after' => 'allowed_domains', 'namespace' => 'CachetHQ\Cachet\Controllers\Api', 'version' => 'v1'], function () {
|
||||
Route::api(['after' => 'allowed_domains', 'namespace' => 'CachetHQ\Cachet\Http\Controllers\Api', 'version' => 'v1'], function () {
|
||||
Route::get('components', 'ComponentController@getComponents');
|
||||
Route::get('components/{id}', 'ComponentController@getComponent');
|
||||
Route::get('components/{id}/incidents', 'ComponentController@getComponentIncidents');
|
||||
|
@ -1,16 +1,16 @@
|
||||
<?php
|
||||
|
||||
// Prevent access until the app is setup.
|
||||
Route::group(['before' => 'has_setting:app_name', 'namespace' => 'CachetHQ\Cachet\Controllers'], function () {
|
||||
Route::group(['before' => 'has_setting:app_name', 'namespace' => 'CachetHQ\Cachet\Http\Controllers'], function () {
|
||||
Route::get('/', ['as' => 'status-page', 'uses' => 'HomeController@showIndex']);
|
||||
Route::get('/incident/{incident}', 'HomeController@showIncident');
|
||||
});
|
||||
|
||||
// Setup route.
|
||||
Route::group(['before' => 'is_setup', 'namespace' => 'CachetHQ\Cachet\Controllers'], function () {
|
||||
Route::group(['before' => 'is_setup', 'namespace' => 'CachetHQ\Cachet\Http\Controllers'], function () {
|
||||
Route::controller('/setup', 'SetupController');
|
||||
});
|
||||
|
||||
Route::group(['namespace' => 'CachetHQ\Cachet\Controllers'], function () {
|
||||
Route::group(['namespace' => 'CachetHQ\Cachet\Http\Controllers'], function () {
|
||||
Route::get('/rss', 'RssController@feedAction');
|
||||
});
|
||||
|
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
Route::group(['before' => 'has_setting:app_name', 'namespace' => 'CachetHQ\Cachet\Controllers'], function () {
|
||||
Route::group(['before' => 'has_setting:app_name', 'namespace' => 'CachetHQ\Cachet\Http\Controllers'], function () {
|
||||
Route::get('/auth/login', ['before' => 'guest', 'as' => 'login', 'uses' => 'AuthController@showLogin']);
|
||||
Route::post('/auth/login', ['before' => 'guest|csrf|login_throttling', 'as' => 'logout', 'uses' => 'AuthController@postLogin']);
|
||||
});
|
||||
|
||||
Route::group(['before' => 'auth', 'namespace' => 'CachetHQ\Cachet\Controllers'], function () {
|
||||
Route::group(['before' => 'auth', 'namespace' => 'CachetHQ\Cachet\Http\Controllers'], function () {
|
||||
Route::get('/auth/logout', ['as' => 'logout', 'uses' => 'AuthController@logoutAction']);
|
||||
});
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
Route::group(['before' => 'auth', 'prefix' => 'dashboard', 'namespace' => 'CachetHQ\Cachet\Controllers'], function () {
|
||||
Route::group(['before' => 'auth', 'prefix' => 'dashboard', 'namespace' => 'CachetHQ\Cachet\Http\Controllers'], function () {
|
||||
// Dashboard
|
||||
Route::get('/', ['as' => 'dashboard', 'uses' => 'DashboardController@showDashboard']);
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Dingo\Api\Facade\API;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/*
|
||||
@ -63,15 +64,11 @@ App::down(function () {
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Require The Filters File
|
||||
| View Composers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Next we will load the filters file for the application. This gives us
|
||||
| a nice separate location to store our route and application filter
|
||||
| definitions instead of putting them all in the main routes file.
|
||||
| Register Cachet's view composers.
|
||||
|
|
||||
*/
|
||||
|
||||
require app_path().'/filters.php';
|
||||
require app_path().'/view-composers.php';
|
||||
require app_path().'/helpers.php';
|
||||
require app_path('view-composers.php');
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
use CachetHQ\Cachet\Models\Incident;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
View::composer('index', function ($view) {
|
||||
|
@ -54,8 +54,7 @@ $app->bindInstallPaths(require __DIR__.'/paths.php');
|
||||
|
|
||||
*/
|
||||
|
||||
$framework = $app['path.base'].
|
||||
'/vendor/laravel/framework/src';
|
||||
$framework = $app['path.base'].'/vendor/laravel/framework/src';
|
||||
|
||||
require $framework.'/Illuminate/Foundation/start.php';
|
||||
|
||||
|
@ -28,9 +28,10 @@
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"app/database/migrations",
|
||||
"app/database/seeds",
|
||||
"app/filters",
|
||||
"app/models"
|
||||
"app/database/seeds"
|
||||
],
|
||||
"files": [
|
||||
"src/helpers.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"CachetHQ\\Cachet\\": "src/"
|
||||
@ -38,7 +39,7 @@
|
||||
},
|
||||
"autoload-dev": {
|
||||
"classmap": [
|
||||
"app/tests/TestCase.php"
|
||||
"tests/TestCase.php"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
|
2
composer.lock
generated
2
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "af0ee6e5bc07e350732bc7c907e3b2ae",
|
||||
"hash": "bb692ec0057ca30fa36edd005963b3cb",
|
||||
"packages": [
|
||||
{
|
||||
"name": "classpreloader/classpreloader",
|
||||
|
@ -15,14 +15,12 @@
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Cachet Test Suite">
|
||||
<directory>./app/tests/</directory>
|
||||
<directory>./tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist processUncoveredFilesFromWhitelist="true">
|
||||
<directory suffix=".php">./src</directory>
|
||||
<directory suffix=".php">./app/filters</directory>
|
||||
<directory suffix=".php">./app/models</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
</phpunit>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Commands;
|
||||
namespace CachetHQ\Cachet\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
@ -1,8 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Http\After;
|
||||
|
||||
use CachetHQ\Cachet\Models\Setting;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Route;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class AllowedDomainsFilter
|
||||
{
|
||||
public function filter($route, $request, $response)
|
||||
public function filter(Route $route, Request $request, Response $response)
|
||||
{
|
||||
// Always allow our own domain.
|
||||
$ourDomain = Setting::get('app_domain');
|
17
src/Http/After/CorsFilter.php
Normal file
17
src/Http/After/CorsFilter.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Http\After;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Route;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class CorsFilter
|
||||
{
|
||||
public function filter(Route $route, Request $request, Response $response)
|
||||
{
|
||||
$response->headers->set('Access-Control-Allow-Origin', '*');
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
13
src/Http/Before/AuthBasicFilter.php
Normal file
13
src/Http/Before/AuthBasicFilter.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Http\Before;
|
||||
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class AuthBasicFilter
|
||||
{
|
||||
public function filter()
|
||||
{
|
||||
return Auth::basic();
|
||||
}
|
||||
}
|
23
src/Http/Before/AuthFilter.php
Normal file
23
src/Http/Before/AuthFilter.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Http\Before;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Route;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
|
||||
class AuthFilter
|
||||
{
|
||||
public function filter(Route $route, Request $request)
|
||||
{
|
||||
if (Auth::guest()) {
|
||||
if ($request->ajax()) {
|
||||
return Response::make('Unauthorized', 401);
|
||||
} else {
|
||||
return Redirect::guest('auth/login');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
17
src/Http/Before/CsrfFilter.php
Normal file
17
src/Http/Before/CsrfFilter.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Http\Before;
|
||||
|
||||
use Illuminate\Session\TokenMismatchException;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
|
||||
class CsrfFilter
|
||||
{
|
||||
public function filter()
|
||||
{
|
||||
if (Session::token() !== Input::get('_token')) {
|
||||
throw new TokenMismatchException();
|
||||
}
|
||||
}
|
||||
}
|
16
src/Http/Before/GuestFilter.php
Normal file
16
src/Http/Before/GuestFilter.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Http\Before;
|
||||
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
|
||||
class GuestFilter
|
||||
{
|
||||
public function filter()
|
||||
{
|
||||
if (Auth::check()) {
|
||||
return Redirect::to('/');
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Http\Before;
|
||||
|
||||
use CachetHQ\Cachet\Models\Setting;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Route;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
|
||||
class HasSettingFilter
|
||||
{
|
||||
public function filter($route, $request, $settingName)
|
||||
public function filter(Route $route, Request $request, $settingName)
|
||||
{
|
||||
try {
|
||||
$setting = Setting::where('name', $settingName)->first();
|
@ -1,8 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Http\Before;
|
||||
|
||||
use CachetHQ\Cachet\Models\Setting;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Route;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
|
||||
class IsSetupFilter
|
||||
{
|
||||
public function filter($route, $request)
|
||||
public function filter(Route $route, Request $request)
|
||||
{
|
||||
try {
|
||||
$setting = Setting::where('name', 'app_name')->first();
|
@ -1,10 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Http\Before;
|
||||
|
||||
use GrahamCampbell\Throttle\Facades\Throttle;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Route;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
|
||||
class LoginThrottlingFilter
|
||||
{
|
||||
public function filter($route, $request)
|
||||
public function filter(Route $route, Request $request)
|
||||
{
|
||||
// check if we've reached the rate limit, but don't hit the throttle yet
|
||||
// we can hit the throttle later on in the if validation passes
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Controllers\Api;
|
||||
namespace CachetHQ\Cachet\Http\Controllers\Api;
|
||||
|
||||
use CachetHQ\Cachet\Repositories\Component\ComponentRepository;
|
||||
use Dingo\Api\Routing\ControllerTrait;
|
||||
@ -45,7 +45,7 @@ class ComponentController extends Controller
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return \Component
|
||||
* @return \CachetHQ\Cachet\Models\Component
|
||||
*/
|
||||
public function getComponent($id)
|
||||
{
|
||||
@ -55,9 +55,9 @@ class ComponentController extends Controller
|
||||
/**
|
||||
* Return a component with incidents.
|
||||
*
|
||||
* @param int $id Component ID
|
||||
* @param int $id
|
||||
*
|
||||
* @return \Component
|
||||
* @return \CachetHQ\Cachet\Models\Component
|
||||
*/
|
||||
public function getComponentIncidents($id)
|
||||
{
|
||||
@ -67,7 +67,7 @@ class ComponentController extends Controller
|
||||
/**
|
||||
* Create a new component.
|
||||
*
|
||||
* @return \Component
|
||||
* @return \CachetHQ\Cachet\Models\Component
|
||||
*/
|
||||
public function postComponents()
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Controllers\Api;
|
||||
namespace CachetHQ\Cachet\Http\Controllers\Api;
|
||||
|
||||
use CachetHQ\Cachet\Repositories\Incident\IncidentRepository;
|
||||
use Dingo\Api\Routing\ControllerTrait;
|
||||
@ -45,7 +45,7 @@ class IncidentController extends Controller
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return \Incident
|
||||
* @return \CachetHQ\Cachet\Models\Incident
|
||||
*/
|
||||
public function getIncident($id)
|
||||
{
|
||||
@ -55,7 +55,7 @@ class IncidentController extends Controller
|
||||
/**
|
||||
* Create a new incident.
|
||||
*
|
||||
* @return \Incident
|
||||
* @return \CachetHQ\Cachet\Models\Incident
|
||||
*/
|
||||
public function postIncidents()
|
||||
{
|
||||
@ -67,7 +67,7 @@ class IncidentController extends Controller
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return \Incident
|
||||
* @return \CachetHQ\Cachet\Models\Incident
|
||||
*/
|
||||
public function putIncident($id)
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Controllers\Api;
|
||||
namespace CachetHQ\Cachet\Http\Controllers\Api;
|
||||
|
||||
use CachetHQ\Cachet\Repositories\Metric\MetricRepository;
|
||||
use Dingo\Api\Routing\ControllerTrait;
|
||||
@ -44,7 +44,7 @@ class MetricController extends Controller
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return \Metric
|
||||
* @return \CachetHQ\Cachet\Models\Metric
|
||||
*/
|
||||
public function getMetric($id)
|
||||
{
|
||||
@ -54,7 +54,7 @@ class MetricController extends Controller
|
||||
/**
|
||||
* Create a new metric.
|
||||
*
|
||||
* @return \Metric
|
||||
* @return \CachetHQ\Cachet\Models\Metric
|
||||
*/
|
||||
public function postMetrics()
|
||||
{
|
||||
@ -66,7 +66,7 @@ class MetricController extends Controller
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return \Metric
|
||||
* @return \CachetHQ\Cachet\Models\Metric
|
||||
*/
|
||||
public function putMetric($id)
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Controllers\Api;
|
||||
namespace CachetHQ\Cachet\Http\Controllers\Api;
|
||||
|
||||
use CachetHQ\Cachet\Repositories\MetricPoint\MetricPointRepository;
|
||||
use Dingo\Api\Routing\ControllerTrait;
|
||||
@ -44,7 +44,7 @@ class MetricPointController extends Controller
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return \MetricPoint
|
||||
* @return \CachetHQ\Cachet\Models\MetricPoint
|
||||
*/
|
||||
public function getMetricPoint($id)
|
||||
{
|
||||
@ -54,7 +54,7 @@ class MetricPointController extends Controller
|
||||
/**
|
||||
* Create a new metric point.
|
||||
*
|
||||
* @return \MetricPoint
|
||||
* @return \CachetHQ\Cachet\Models\MetricPoint
|
||||
*/
|
||||
public function postMetricPoints()
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Controllers;
|
||||
namespace CachetHQ\Cachet\Http\Controllers;
|
||||
|
||||
use GrahamCampbell\Throttle\Facades\Throttle;
|
||||
use Illuminate\Routing\Controller;
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Controllers;
|
||||
namespace CachetHQ\Cachet\Http\Controllers;
|
||||
|
||||
use Component;
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
use Exception;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
@ -12,11 +12,11 @@ class DashAPIController extends Controller
|
||||
/**
|
||||
* Updates a component with the entered info.
|
||||
*
|
||||
* @param \Component $component
|
||||
* @param \CachetHQ\Cachet\Models\Component $component
|
||||
*
|
||||
* @throws \Exception
|
||||
*
|
||||
* @return \Component
|
||||
* @return \CachetHQ\Cachet\Models\Component
|
||||
*/
|
||||
public function postUpdateComponent(Component $component)
|
||||
{
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Controllers;
|
||||
namespace CachetHQ\Cachet\Http\Controllers;
|
||||
|
||||
use Component;
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
@ -28,7 +28,7 @@ class DashComponentController extends Controller
|
||||
/**
|
||||
* Shows the edit component view.
|
||||
*
|
||||
* @param \Component $component
|
||||
* @param \CachetHQ\Cachet\Models\Component $component
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
@ -43,7 +43,7 @@ class DashComponentController extends Controller
|
||||
/**
|
||||
* Updates a component.
|
||||
*
|
||||
* @param \Component $component
|
||||
* @param \CachetHQ\Cachet\Models\Component $component
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
@ -83,7 +83,7 @@ class DashComponentController extends Controller
|
||||
/**
|
||||
* Deletes a given component.
|
||||
*
|
||||
* @param \Component $component
|
||||
* @param \CachetHQ\Cachet\Models\Component $component
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
@ -1,13 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Controllers;
|
||||
namespace CachetHQ\Cachet\Http\Controllers;
|
||||
|
||||
use CachetHQ\Cachet\Models\Incident;
|
||||
use CachetHQ\Cachet\Models\IncidentTemplate;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Incident;
|
||||
use IncidentTemplate;
|
||||
|
||||
class DashIncidentController extends Controller
|
||||
{
|
||||
@ -79,7 +79,7 @@ class DashIncidentController extends Controller
|
||||
/**
|
||||
* Deletes a given incident.
|
||||
*
|
||||
* @param \Incident $incident
|
||||
* @param \CachetHQ\Cachet\Models\Incident $incident
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
@ -1,13 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Controllers;
|
||||
namespace CachetHQ\Cachet\Http\Controllers;
|
||||
|
||||
use CachetHQ\Cachet\Models\Setting;
|
||||
use Exception;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Setting;
|
||||
|
||||
class DashSettingsController extends Controller
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Controllers;
|
||||
namespace CachetHQ\Cachet\Http\Controllers;
|
||||
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Facades\Auth;
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Controllers;
|
||||
namespace CachetHQ\Cachet\Http\Controllers;
|
||||
|
||||
use Component;
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
@ -1,14 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Controllers;
|
||||
namespace CachetHQ\Cachet\Http\Controllers;
|
||||
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
use CachetHQ\Cachet\Models\Incident;
|
||||
use CachetHQ\Cachet\Models\Setting;
|
||||
use Carbon\Carbon;
|
||||
use Component;
|
||||
use GrahamCampbell\Markdown\Facades\Markdown;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Incident;
|
||||
use Setting;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Controllers;
|
||||
namespace CachetHQ\Cachet\Http\Controllers;
|
||||
|
||||
use CachetHQ\Cachet\Models\Incident;
|
||||
use CachetHQ\Cachet\Models\Setting;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
use Incident;
|
||||
use Setting;
|
||||
use Thujohn\Rss\RssFacade;
|
||||
|
||||
class RssController extends Controller
|
@ -1,15 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Controllers;
|
||||
namespace CachetHQ\Cachet\Http\Controllers;
|
||||
|
||||
use CachetHQ\Cachet\Models\Setting;
|
||||
use CachetHQ\Cachet\Models\User;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Setting;
|
||||
use User;
|
||||
|
||||
class SetupController extends Controller
|
||||
{
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Models;
|
||||
|
||||
use CachetHQ\Cachet\Transformers\ComponentTransformer;
|
||||
use Dingo\Api\Transformer\TransformableInterface;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
@ -37,7 +39,7 @@ class Component extends Model implements TransformableInterface
|
||||
*/
|
||||
public function incidents()
|
||||
{
|
||||
return $this->hasMany('Incident', 'component_id', 'id');
|
||||
return $this->hasMany('CachetHQ\Cachet\Models\Incident', 'component_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Models;
|
||||
|
||||
use CachetHQ\Cachet\Transformers\IncidentTransformer;
|
||||
use Dingo\Api\Transformer\TransformableInterface;
|
||||
use GrahamCampbell\Markdown\Facades\Markdown;
|
||||
@ -45,7 +47,7 @@ class Incident extends Model implements TransformableInterface
|
||||
*/
|
||||
public function component()
|
||||
{
|
||||
return $this->belongsTo('Component', 'component_id', 'id');
|
||||
return $this->belongsTo('CachetHQ\Cachet\Models\Component', 'component_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Str;
|
||||
use Watson\Validating\ValidatingTrait;
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Models;
|
||||
|
||||
use CachetHQ\Cachet\Transformers\MetricTransformer;
|
||||
use Dingo\Api\Transformer\TransformableInterface;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
@ -34,7 +36,7 @@ class Metric extends Model implements TransformableInterface
|
||||
*/
|
||||
public function points()
|
||||
{
|
||||
return $this->hasMany('MetricPoint', 'metric_id', 'id');
|
||||
return $this->hasMany('CachetHQ\Cachet\Models\MetricPoint', 'metric_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class MetricPoint extends Model
|
||||
@ -11,6 +13,6 @@ class MetricPoint extends Model
|
||||
*/
|
||||
public function metric()
|
||||
{
|
||||
return $this->belongsTo('Metric', 'id', 'metric_id');
|
||||
return $this->belongsTo('CachetHQ\Cachet\Models\Metric', 'id', 'metric_id');
|
||||
}
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Watson\Validating\ValidatingTrait;
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Setting extends Model
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingTrait;
|
||||
use Watson\Validating\ValidatingTrait;
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Models;
|
||||
|
||||
use Illuminate\Auth\Reminders\RemindableInterface;
|
||||
use Illuminate\Auth\Reminders\RemindableTrait;
|
||||
use Illuminate\Auth\UserInterface;
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Models;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\ClientException;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
@ -17,7 +19,7 @@ class WebHook extends Model
|
||||
/**
|
||||
* Returns all responses for a WebHook.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function response()
|
||||
{
|
||||
@ -37,9 +39,9 @@ class WebHook extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Setups a Ping event that is fired upon a web hook.
|
||||
* Setups a ping event that is fired upon a web hook.
|
||||
*
|
||||
* @return object
|
||||
* @return \CachetHQ\Cachet\Models\WebHookResponse
|
||||
*/
|
||||
public function ping()
|
||||
{
|
||||
@ -49,10 +51,10 @@ class WebHook extends Model
|
||||
/**
|
||||
* Fires the actual web hook event.
|
||||
*
|
||||
* @param string $eventType the event to send X-Cachet-Event
|
||||
* @param string $eventType The event to send X-Cachet-Event
|
||||
* @param mixed $data Data to send to the Web Hook
|
||||
*
|
||||
* @return object
|
||||
* @return \CachetHQ\Cachet\Models\WebHookResponse
|
||||
*/
|
||||
public function fire($eventType, $data = null)
|
||||
{
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class WebHookResponse extends Model
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Providers;
|
||||
|
||||
use CachetHQ\Cachet\Commands\OneClickDeployCommand;
|
||||
use CachetHQ\Cachet\Console\Commands\OneClickDeployCommand;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class ConsoleServiceProvider extends ServiceProvider
|
||||
@ -14,7 +14,7 @@ class ConsoleServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->commands('CachetHQ\Cachet\Commands\OneClickDeployCommand');
|
||||
$this->commands('CachetHQ\Cachet\Console\Commands\OneClickDeployCommand');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -24,7 +24,7 @@ class ConsoleServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->app->singleton('CachetHQ\Cachet\Commands\OneClickDeployCommand', function ($app) {
|
||||
$this->app->singleton('CachetHQ\Cachet\Console\Commands\OneClickDeployCommand', function ($app) {
|
||||
return new OneClickDeployCommand($app->environment('heroku'));
|
||||
});
|
||||
}
|
||||
|
@ -12,6 +12,40 @@ class RoutingServiceProvider extends ServiceProvider
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->registerFilters();
|
||||
$this->registerBindings();
|
||||
$this->registerRoutes();
|
||||
}
|
||||
|
||||
protected function registerFilters()
|
||||
{
|
||||
// Laravel's before filters
|
||||
$this->app->router->filter('auth', 'CachetHQ\Cachet\Http\Before\AuthFilter');
|
||||
$this->app->router->filter('auth.basic', 'CachetHQ\Cachet\Http\Before\AuthBasicFilter');
|
||||
$this->app->router->filter('guest', 'CachetHQ\Cachet\Http\Before\GuestFilter');
|
||||
$this->app->router->filter('csrf', 'CachetHQ\Cachet\Http\Before\CsrfFilter');
|
||||
|
||||
// Cachet's before filters
|
||||
$this->app->router->filter('is_setup', 'CachetHQ\Cachet\Http\Before\IsSetupFilter');
|
||||
$this->app->router->filter('has_setting', 'CachetHQ\Cachet\Http\Before\HasSettingFilter');
|
||||
$this->app->router->filter('login_throttling', 'CachetHQ\Cachet\Http\Before\LoginThrottlingFilter');
|
||||
|
||||
// Cachet's after filters
|
||||
$this->app->router->filter('allowed_domains', 'CachetHQ\Cachet\Http\After\AllowedDomainsFilter');
|
||||
$this->app->router->filter('cors', 'CachetHQ\Cachet\Http\After\CorsFilter');
|
||||
}
|
||||
|
||||
protected function registerBindings()
|
||||
{
|
||||
$this->app->router->model('component', 'CachetHQ\Cachet\Models\Component');
|
||||
$this->app->router->model('incident', 'CachetHQ\Cachet\Models\Incident');
|
||||
$this->app->router->model('incident_template', 'CachetHQ\Cachet\Models\IncidentTemplate');
|
||||
$this->app->router->model('setting', 'CachetHQ\Cachet\Models\Setting');
|
||||
$this->app->router->model('user', 'CachetHQ\Cachet\Models\User');
|
||||
}
|
||||
|
||||
protected function registerRoutes()
|
||||
{
|
||||
$files = glob(app_path('routes').'/*.php');
|
||||
|
||||
|
@ -2,22 +2,22 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Repositories\Component;
|
||||
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
use CachetHQ\Cachet\Repositories\EloquentRepository;
|
||||
use Component;
|
||||
|
||||
class EloquentComponentRepository extends EloquentRepository implements ComponentRepository
|
||||
{
|
||||
/**
|
||||
* The eloquent model instance.
|
||||
*
|
||||
* @var \Component
|
||||
* @var \CachetHQ\Cachet\Models\Component
|
||||
*/
|
||||
protected $model;
|
||||
|
||||
/**
|
||||
* Create a new eloquent component repository instance.
|
||||
*
|
||||
* @param \Component $model
|
||||
* @param \CachetHQ\Cachet\Models\Component $model
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
@ -2,22 +2,22 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Repositories\Incident;
|
||||
|
||||
use CachetHQ\Cachet\Models\Incident;
|
||||
use CachetHQ\Cachet\Repositories\EloquentRepository;
|
||||
use Incident;
|
||||
|
||||
class EloquentIncidentRepository extends EloquentRepository implements IncidentRepository
|
||||
{
|
||||
/**
|
||||
* The eloquent model instance.
|
||||
*
|
||||
* @var \Incident
|
||||
* @var \CachetHQ\Cachet\Models\Incident
|
||||
*/
|
||||
protected $model;
|
||||
|
||||
/**
|
||||
* Create a new eloquent incident repository instance.
|
||||
*
|
||||
* @param \Incident $model
|
||||
* @param \CachetHQ\Cachet\Models\Incident $model
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
@ -2,22 +2,22 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Repositories\Metric;
|
||||
|
||||
use CachetHQ\Cachet\Models\Metric;
|
||||
use CachetHQ\Cachet\Repositories\EloquentRepository;
|
||||
use Metric;
|
||||
|
||||
class EloquentMetricRepository extends EloquentRepository implements MetricRepository
|
||||
{
|
||||
/**
|
||||
* The eloquent model instance.
|
||||
*
|
||||
* @var \Metric
|
||||
* @var \CachetHQ\Cachet\Models\Metric
|
||||
*/
|
||||
protected $model;
|
||||
|
||||
/**
|
||||
* Create a new eloquent metric repository instance.
|
||||
*
|
||||
* @param \Metric $model
|
||||
* @param \CachetHQ\Cachet\Models\Metric $model
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
@ -2,22 +2,22 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Repositories\MetricPoint;
|
||||
|
||||
use CachetHQ\Cachet\Models\MetricPoint;
|
||||
use CachetHQ\Cachet\Repositories\EloquentRepository;
|
||||
use MetricPoint;
|
||||
|
||||
class EloquentMetricPointRepository extends EloquentRepository implements MetricPointRepository
|
||||
{
|
||||
/**
|
||||
* The eloquent model instance.
|
||||
*
|
||||
* @var \MetricPoint
|
||||
* @var \CachetHQ\Cachet\Models\MetricPoint
|
||||
*/
|
||||
protected $model;
|
||||
|
||||
/**
|
||||
* Create a new eloquent metric point repository instance.
|
||||
*
|
||||
* @param \MetricPoint $model
|
||||
* @param \CachetHQ\Cachet\Models\MetricPoint $model
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
@ -2,11 +2,18 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Transformers;
|
||||
|
||||
use Component;
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
use League\Fractal\TransformerAbstract;
|
||||
|
||||
class ComponentTransformer extends TransformerAbstract
|
||||
{
|
||||
/**
|
||||
* Transform a component model into an array.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Component $component
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function transform(Component $component)
|
||||
{
|
||||
return [
|
||||
|
@ -2,11 +2,18 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Transformers;
|
||||
|
||||
use Incident;
|
||||
use CachetHQ\Cachet\Models\Incident;
|
||||
use League\Fractal\TransformerAbstract;
|
||||
|
||||
class IncidentTransformer extends TransformerAbstract
|
||||
{
|
||||
/**
|
||||
* Transform an incident model into an array.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Incident $incident
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function transform(Incident $incident)
|
||||
{
|
||||
$component = $incident->component;
|
||||
|
@ -2,11 +2,18 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Transformers;
|
||||
|
||||
use CachetHQ\Cachet\Models\MetricPoint;
|
||||
use League\Fractal\TransformerAbstract;
|
||||
use MetricPoint;
|
||||
|
||||
class MetricPointTransformer extends TransformerAbstract
|
||||
{
|
||||
/**
|
||||
* Transform a metric point model into an array.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\MetricPoint $metricPoint
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function transform(MetricPoint $metricPoint)
|
||||
{
|
||||
return [
|
||||
|
@ -2,11 +2,18 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Transformers;
|
||||
|
||||
use CachetHQ\Cachet\Models\Metric;
|
||||
use League\Fractal\TransformerAbstract;
|
||||
use Metric;
|
||||
|
||||
class MetricTransformer extends TransformerAbstract
|
||||
{
|
||||
/**
|
||||
* Transform a metric model into an array.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Metric $metric
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function transform(Metric $metric)
|
||||
{
|
||||
return [
|
||||
|
@ -1,6 +1,8 @@
|
||||
<?php
|
||||
|
||||
if (! function_exists('elixir')) {
|
||||
use Illuminate\Support\Facades\Request;
|
||||
|
||||
if (!function_exists('elixir')) {
|
||||
/**
|
||||
* Get the path to a versioned Elixir file.
|
||||
*
|
||||
@ -24,7 +26,7 @@ if (! function_exists('elixir')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('set_active')) {
|
||||
if (!function_exists('set_active')) {
|
||||
|
||||
/**
|
||||
* Set active class if request is in path.
|
||||
@ -35,7 +37,7 @@ if (! function_exists('set_active')) {
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function set_active($path, $classes = [], $active = 'active')
|
||||
function set_active($path, array $classes = [], $active = 'active')
|
||||
{
|
||||
if (Request::is($path)) {
|
||||
$classes[] = $active;
|
@ -17,7 +17,7 @@ class ComponentControllerTest extends TestCase
|
||||
{
|
||||
$this->repo->shouldReceive('all')->once()->andReturn('foo');
|
||||
|
||||
$controller = new CachetHQ\Cachet\Controllers\Api\ComponentController($this->repo);
|
||||
$controller = new CachetHQ\Cachet\Http\Controllers\Api\ComponentController($this->repo);
|
||||
$response = $controller->getComponents();
|
||||
|
||||
$this->assertEquals('foo', $response);
|
||||
@ -27,7 +27,7 @@ class ComponentControllerTest extends TestCase
|
||||
{
|
||||
$this->repo->shouldReceive('findOrFail')->with(1)->once()->andReturn('foo');
|
||||
|
||||
$controller = new CachetHQ\Cachet\Controllers\Api\ComponentController($this->repo);
|
||||
$controller = new CachetHQ\Cachet\Http\Controllers\Api\ComponentController($this->repo);
|
||||
$response = $controller->getComponent(1);
|
||||
|
||||
$this->assertEquals('foo', $response);
|
@ -13,6 +13,6 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
|
||||
|
||||
$testEnvironment = 'testing';
|
||||
|
||||
return require __DIR__.'/../../bootstrap/start.php';
|
||||
return require __DIR__.'/../bootstrap/start.php';
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user