@@ -8,37 +8,37 @@ |
||
8 | 8 | |
9 | 9 | class RedirectIfAuthenticated |
10 | 10 | { |
11 | - /** |
|
12 | - * The Guard implementation. |
|
13 | - * |
|
14 | - * @var Guard |
|
15 | - */ |
|
16 | - protected $auth; |
|
11 | + /** |
|
12 | + * The Guard implementation. |
|
13 | + * |
|
14 | + * @var Guard |
|
15 | + */ |
|
16 | + protected $auth; |
|
17 | 17 | |
18 | - /** |
|
19 | - * Create a new filter instance. |
|
20 | - * |
|
21 | - * @param Guard $auth |
|
22 | - */ |
|
23 | - public function __construct(Guard $auth) |
|
24 | - { |
|
25 | - $this->auth = $auth; |
|
26 | - } |
|
18 | + /** |
|
19 | + * Create a new filter instance. |
|
20 | + * |
|
21 | + * @param Guard $auth |
|
22 | + */ |
|
23 | + public function __construct(Guard $auth) |
|
24 | + { |
|
25 | + $this->auth = $auth; |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * Handle an incoming request. |
|
30 | - * |
|
31 | - * @param \Illuminate\Http\Request $request |
|
32 | - * @param \Closure $next |
|
33 | - * |
|
34 | - * @return mixed |
|
35 | - */ |
|
36 | - public function handle($request, Closure $next) |
|
37 | - { |
|
38 | - if ($this->auth->check()) { |
|
39 | - return new RedirectResponse(url('/home')); |
|
40 | - } |
|
28 | + /** |
|
29 | + * Handle an incoming request. |
|
30 | + * |
|
31 | + * @param \Illuminate\Http\Request $request |
|
32 | + * @param \Closure $next |
|
33 | + * |
|
34 | + * @return mixed |
|
35 | + */ |
|
36 | + public function handle($request, Closure $next) |
|
37 | + { |
|
38 | + if ($this->auth->check()) { |
|
39 | + return new RedirectResponse(url('/home')); |
|
40 | + } |
|
41 | 41 | |
42 | - return $next($request); |
|
43 | - } |
|
42 | + return $next($request); |
|
43 | + } |
|
44 | 44 | } |
@@ -7,21 +7,21 @@ |
||
7 | 7 | |
8 | 8 | class VerifyCsrfToken extends BaseVerifier |
9 | 9 | { |
10 | - /** |
|
11 | - * Handle an incoming request. |
|
12 | - * |
|
13 | - * @param \Illuminate\Http\Request $request |
|
14 | - * @param \Closure $next |
|
15 | - * |
|
16 | - * @return mixed |
|
17 | - */ |
|
18 | - public function handle($request, Closure $next) |
|
19 | - { |
|
20 | - // Do not perform CSRF checks for API requests |
|
21 | - if (preg_match('#^/api#', $request->path()) !== false) { |
|
22 | - return $next($request); |
|
23 | - } |
|
10 | + /** |
|
11 | + * Handle an incoming request. |
|
12 | + * |
|
13 | + * @param \Illuminate\Http\Request $request |
|
14 | + * @param \Closure $next |
|
15 | + * |
|
16 | + * @return mixed |
|
17 | + */ |
|
18 | + public function handle($request, Closure $next) |
|
19 | + { |
|
20 | + // Do not perform CSRF checks for API requests |
|
21 | + if (preg_match('#^/api#', $request->path()) !== false) { |
|
22 | + return $next($request); |
|
23 | + } |
|
24 | 24 | |
25 | - return parent::handle($request, $next); |
|
26 | - } |
|
25 | + return parent::handle($request, $next); |
|
26 | + } |
|
27 | 27 | } |
@@ -6,17 +6,17 @@ |
||
6 | 6 | |
7 | 7 | abstract class Request extends FormRequest |
8 | 8 | { |
9 | - public function __construct() |
|
10 | - { |
|
11 | - parent::__construct(); |
|
9 | + public function __construct() |
|
10 | + { |
|
11 | + parent::__construct(); |
|
12 | 12 | |
13 | - $this->validateMac(); |
|
14 | - } |
|
13 | + $this->validateMac(); |
|
14 | + } |
|
15 | 15 | |
16 | - public function validateMac() |
|
17 | - { |
|
18 | - app('validator')->extend('mac', function ($attribute, $value, $parameters) { |
|
19 | - return preg_match('/^(([0-9a-fA-F]{2}-){5}|([0-9a-fA-F]{2}:){5})[0-9a-fA-F]{2}$/', $value); |
|
20 | - }); |
|
21 | - } |
|
16 | + public function validateMac() |
|
17 | + { |
|
18 | + app('validator')->extend('mac', function ($attribute, $value, $parameters) { |
|
19 | + return preg_match('/^(([0-9a-fA-F]{2}-){5}|([0-9a-fA-F]{2}:){5})[0-9a-fA-F]{2}$/', $value); |
|
20 | + }); |
|
21 | + } |
|
22 | 22 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | |
16 | 16 | public function validateMac() |
17 | 17 | { |
18 | - app('validator')->extend('mac', function ($attribute, $value, $parameters) { |
|
18 | + app('validator')->extend('mac', function($attribute, $value, $parameters) { |
|
19 | 19 | return preg_match('/^(([0-9a-fA-F]{2}-){5}|([0-9a-fA-F]{2}:){5})[0-9a-fA-F]{2}$/', $value); |
20 | 20 | }); |
21 | 21 | } |
@@ -6,34 +6,34 @@ |
||
6 | 6 | |
7 | 7 | class StoreComputerRequest extends Request |
8 | 8 | { |
9 | - /** |
|
10 | - * Determine if the user is authorized to make this request. |
|
11 | - * |
|
12 | - * @return bool |
|
13 | - */ |
|
14 | - public function authorize() |
|
15 | - { |
|
16 | - return true; |
|
17 | - } |
|
9 | + /** |
|
10 | + * Determine if the user is authorized to make this request. |
|
11 | + * |
|
12 | + * @return bool |
|
13 | + */ |
|
14 | + public function authorize() |
|
15 | + { |
|
16 | + return true; |
|
17 | + } |
|
18 | 18 | |
19 | - /** |
|
20 | - * Get the validation rules that apply to the request. |
|
21 | - * |
|
22 | - * @return array |
|
23 | - */ |
|
24 | - public function rules() |
|
25 | - { |
|
26 | - return [ |
|
27 | - 'ip' => 'required|ip', |
|
28 | - 'mac' => 'required|mac', |
|
29 | - 'name' => 'required', |
|
30 | - 'group' => 'alpha_dash|max:30', |
|
31 | - 'public' => 'in:true,false,auto', |
|
32 | - ]; |
|
33 | - } |
|
19 | + /** |
|
20 | + * Get the validation rules that apply to the request. |
|
21 | + * |
|
22 | + * @return array |
|
23 | + */ |
|
24 | + public function rules() |
|
25 | + { |
|
26 | + return [ |
|
27 | + 'ip' => 'required|ip', |
|
28 | + 'mac' => 'required|mac', |
|
29 | + 'name' => 'required', |
|
30 | + 'group' => 'alpha_dash|max:30', |
|
31 | + 'public' => 'in:true,false,auto', |
|
32 | + ]; |
|
33 | + } |
|
34 | 34 | |
35 | - public function response(array $errors) |
|
36 | - { |
|
37 | - return new JsonResponse($errors, 422); |
|
38 | - } |
|
35 | + public function response(array $errors) |
|
36 | + { |
|
37 | + return new JsonResponse($errors, 422); |
|
38 | + } |
|
39 | 39 | } |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | Route::get('/stats', 'WelcomeController@statistics'); |
8 | 8 | |
9 | -Route::group(['prefix' => 'api/v1', 'namespace' => 'Api'], function () { |
|
9 | +Route::group(['prefix' => 'api/v1', 'namespace' => 'Api'], function() { |
|
10 | 10 | Route::resource('devices', 'DeviceController', ['except' => ['create', 'edit']]); |
11 | 11 | |
12 | 12 | Route::post('devices/poke', [ |
@@ -7,13 +7,13 @@ |
||
7 | 7 | Route::get('/stats', 'WelcomeController@statistics'); |
8 | 8 | |
9 | 9 | Route::group(['prefix' => 'api/v1', 'namespace' => 'Api'], function () { |
10 | - Route::get('/devices/@{group}', 'DeviceController@index'); |
|
11 | - Route::resource('devices', 'DeviceController', ['except' => ['create', 'edit']]); |
|
10 | + Route::get('/devices/@{group}', 'DeviceController@index'); |
|
11 | + Route::resource('devices', 'DeviceController', ['except' => ['create', 'edit']]); |
|
12 | 12 | |
13 | - Route::post('devices/poke', [ |
|
14 | - 'as' => 'devices.poke', |
|
15 | - 'uses' => 'DeviceController@poke', |
|
16 | - ]); |
|
13 | + Route::post('devices/poke', [ |
|
14 | + 'as' => 'devices.poke', |
|
15 | + 'uses' => 'DeviceController@poke', |
|
16 | + ]); |
|
17 | 17 | }); |
18 | 18 | |
19 | 19 | Route::get('/@{group}', 'GroupController@show'); |
@@ -7,22 +7,22 @@ |
||
7 | 7 | |
8 | 8 | class AppServiceProvider extends ServiceProvider |
9 | 9 | { |
10 | - /** |
|
11 | - * Bootstrap any application services. |
|
12 | - */ |
|
13 | - public function boot() |
|
14 | - { |
|
15 | - // |
|
16 | - } |
|
10 | + /** |
|
11 | + * Bootstrap any application services. |
|
12 | + */ |
|
13 | + public function boot() |
|
14 | + { |
|
15 | + // |
|
16 | + } |
|
17 | 17 | |
18 | - /** |
|
19 | - * Register any application services. |
|
20 | - */ |
|
21 | - public function register() |
|
22 | - { |
|
23 | - $this->app->bind( |
|
24 | - 'Illuminate\Contracts\Auth\Registrar', |
|
25 | - Registrar::class |
|
26 | - ); |
|
27 | - } |
|
18 | + /** |
|
19 | + * Register any application services. |
|
20 | + */ |
|
21 | + public function register() |
|
22 | + { |
|
23 | + $this->app->bind( |
|
24 | + 'Illuminate\Contracts\Auth\Registrar', |
|
25 | + Registrar::class |
|
26 | + ); |
|
27 | + } |
|
28 | 28 | } |
@@ -7,25 +7,25 @@ |
||
7 | 7 | |
8 | 8 | class BusServiceProvider extends ServiceProvider |
9 | 9 | { |
10 | - /** |
|
11 | - * Bootstrap any application services. |
|
12 | - * |
|
13 | - * @param \Illuminate\Bus\Dispatcher $dispatcher |
|
14 | - */ |
|
15 | - public function boot(Dispatcher $dispatcher) |
|
16 | - { |
|
17 | - $dispatcher->mapUsing(function ($command) { |
|
18 | - return Dispatcher::simpleMapping( |
|
19 | - $command, 'PiFinder\Commands', 'PiFinder\Handlers\Commands' |
|
20 | - ); |
|
21 | - }); |
|
22 | - } |
|
10 | + /** |
|
11 | + * Bootstrap any application services. |
|
12 | + * |
|
13 | + * @param \Illuminate\Bus\Dispatcher $dispatcher |
|
14 | + */ |
|
15 | + public function boot(Dispatcher $dispatcher) |
|
16 | + { |
|
17 | + $dispatcher->mapUsing(function ($command) { |
|
18 | + return Dispatcher::simpleMapping( |
|
19 | + $command, 'PiFinder\Commands', 'PiFinder\Handlers\Commands' |
|
20 | + ); |
|
21 | + }); |
|
22 | + } |
|
23 | 23 | |
24 | - /** |
|
25 | - * Register any application services. |
|
26 | - */ |
|
27 | - public function register() |
|
28 | - { |
|
29 | - // |
|
30 | - } |
|
24 | + /** |
|
25 | + * Register any application services. |
|
26 | + */ |
|
27 | + public function register() |
|
28 | + { |
|
29 | + // |
|
30 | + } |
|
31 | 31 | } |
@@ -14,7 +14,7 @@ |
||
14 | 14 | */ |
15 | 15 | public function boot(Dispatcher $dispatcher) |
16 | 16 | { |
17 | - $dispatcher->mapUsing(function ($command) { |
|
17 | + $dispatcher->mapUsing(function($command) { |
|
18 | 18 | return Dispatcher::simpleMapping( |
19 | 19 | $command, 'PiFinder\Commands', 'PiFinder\Handlers\Commands' |
20 | 20 | ); |
@@ -7,23 +7,23 @@ |
||
7 | 7 | |
8 | 8 | class ObserverServiceProvider extends ServiceProvider |
9 | 9 | { |
10 | - /** |
|
11 | - * Bootstrap the application services. |
|
12 | - * |
|
13 | - * @return void |
|
14 | - */ |
|
15 | - public function boot() |
|
16 | - { |
|
17 | - Device::observe(app('PiFinder\Observers\DeviceObserver')); |
|
18 | - } |
|
10 | + /** |
|
11 | + * Bootstrap the application services. |
|
12 | + * |
|
13 | + * @return void |
|
14 | + */ |
|
15 | + public function boot() |
|
16 | + { |
|
17 | + Device::observe(app('PiFinder\Observers\DeviceObserver')); |
|
18 | + } |
|
19 | 19 | |
20 | - /** |
|
21 | - * Register the application services. |
|
22 | - * |
|
23 | - * @return void |
|
24 | - */ |
|
25 | - public function register() |
|
26 | - { |
|
27 | - // |
|
28 | - } |
|
20 | + /** |
|
21 | + * Register the application services. |
|
22 | + * |
|
23 | + * @return void |
|
24 | + */ |
|
25 | + public function register() |
|
26 | + { |
|
27 | + // |
|
28 | + } |
|
29 | 29 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | */ |
36 | 36 | public function map(Router $router) |
37 | 37 | { |
38 | - $router->group(['namespace' => $this->namespace], function ($router) { |
|
38 | + $router->group(['namespace' => $this->namespace], function($router) { |
|
39 | 39 | require app_path('Http/routes.php'); |
40 | 40 | }); |
41 | 41 | } |
@@ -19,7 +19,6 @@ |
||
19 | 19 | /** |
20 | 20 | * Define your route model bindings, pattern filters, etc. |
21 | 21 | * |
22 | - * @param \Illuminate\Routing\Router $router |
|
23 | 22 | */ |
24 | 23 | public function boot() |
25 | 24 | { |
@@ -7,36 +7,36 @@ |
||
7 | 7 | |
8 | 8 | class RouteServiceProvider extends ServiceProvider |
9 | 9 | { |
10 | - /** |
|
11 | - * This namespace is applied to the controller routes in your routes file. |
|
12 | - * |
|
13 | - * In addition, it is set as the URL generator's root namespace. |
|
14 | - * |
|
15 | - * @var string |
|
16 | - */ |
|
17 | - protected $namespace = 'PiFinder\Http\Controllers'; |
|
10 | + /** |
|
11 | + * This namespace is applied to the controller routes in your routes file. |
|
12 | + * |
|
13 | + * In addition, it is set as the URL generator's root namespace. |
|
14 | + * |
|
15 | + * @var string |
|
16 | + */ |
|
17 | + protected $namespace = 'PiFinder\Http\Controllers'; |
|
18 | 18 | |
19 | - /** |
|
20 | - * Define your route model bindings, pattern filters, etc. |
|
21 | - * |
|
22 | - * @param \Illuminate\Routing\Router $router |
|
23 | - */ |
|
24 | - public function boot() |
|
25 | - { |
|
26 | - parent::boot(); |
|
19 | + /** |
|
20 | + * Define your route model bindings, pattern filters, etc. |
|
21 | + * |
|
22 | + * @param \Illuminate\Routing\Router $router |
|
23 | + */ |
|
24 | + public function boot() |
|
25 | + { |
|
26 | + parent::boot(); |
|
27 | 27 | |
28 | - // |
|
29 | - } |
|
28 | + // |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Define the routes for the application. |
|
33 | - * |
|
34 | - * @param \Illuminate\Routing\Router $router |
|
35 | - */ |
|
36 | - public function map(Router $router) |
|
37 | - { |
|
38 | - $router->group(['namespace' => $this->namespace], function ($router) { |
|
39 | - require app_path('Http/routes.php'); |
|
40 | - }); |
|
41 | - } |
|
31 | + /** |
|
32 | + * Define the routes for the application. |
|
33 | + * |
|
34 | + * @param \Illuminate\Routing\Router $router |
|
35 | + */ |
|
36 | + public function map(Router $router) |
|
37 | + { |
|
38 | + $router->group(['namespace' => $this->namespace], function ($router) { |
|
39 | + require app_path('Http/routes.php'); |
|
40 | + }); |
|
41 | + } |
|
42 | 42 | } |