@@ -53,7 +53,7 @@ |
||
53 | 53 | */ |
54 | 54 | public function gettingStarted(MarkdownParser $markdown, Cache $cache, Filesystem $file) |
55 | 55 | { |
56 | - $gettingStarted = $cache->remember('getting-started', 5, function () use ($markdown, $file) { |
|
56 | + $gettingStarted = $cache->remember('getting-started', 5, function() use ($markdown, $file) { |
|
57 | 57 | |
58 | 58 | $gettingStarted = $file->get(base_path('resources/getting-started/readme.md')); |
59 | 59 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | class WelcomeController extends Controller |
13 | 13 | { |
14 | - /* |
|
14 | + /* |
|
15 | 15 | |-------------------------------------------------------------------------- |
16 | 16 | | Welcome Controller |
17 | 17 | |-------------------------------------------------------------------------- |
@@ -22,63 +22,63 @@ discard block |
||
22 | 22 | | |
23 | 23 | */ |
24 | 24 | |
25 | - /** |
|
26 | - * Create a new controller instance. |
|
27 | - */ |
|
28 | - public function __construct() |
|
29 | - { |
|
30 | - $this->middleware('guest'); |
|
31 | - } |
|
25 | + /** |
|
26 | + * Create a new controller instance. |
|
27 | + */ |
|
28 | + public function __construct() |
|
29 | + { |
|
30 | + $this->middleware('guest'); |
|
31 | + } |
|
32 | 32 | |
33 | - /** |
|
34 | - * Show the application welcome screen to the user. |
|
35 | - * |
|
36 | - * @return Response |
|
37 | - */ |
|
38 | - public function index() |
|
39 | - { |
|
40 | - $devices = Device::onHomePage()->get(); |
|
33 | + /** |
|
34 | + * Show the application welcome screen to the user. |
|
35 | + * |
|
36 | + * @return Response |
|
37 | + */ |
|
38 | + public function index() |
|
39 | + { |
|
40 | + $devices = Device::onHomePage()->get(); |
|
41 | 41 | |
42 | - return view('overview')->with(compact('devices')); |
|
43 | - } |
|
42 | + return view('overview')->with(compact('devices')); |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * Show the getting started screen to the user. |
|
47 | - * |
|
48 | - * @param MarkdownParser $markdown |
|
49 | - * @param Cache $cache |
|
50 | - * @param Filesystem $file |
|
51 | - * |
|
52 | - * @return Response |
|
53 | - */ |
|
54 | - public function gettingStarted(MarkdownParser $markdown, Cache $cache, Filesystem $file) |
|
55 | - { |
|
56 | - $gettingStarted = $cache->remember('getting-started', 5, function () use ($markdown, $file) { |
|
57 | - $gettingStarted = $file->get(base_path('resources/getting-started/readme.md')); |
|
45 | + /** |
|
46 | + * Show the getting started screen to the user. |
|
47 | + * |
|
48 | + * @param MarkdownParser $markdown |
|
49 | + * @param Cache $cache |
|
50 | + * @param Filesystem $file |
|
51 | + * |
|
52 | + * @return Response |
|
53 | + */ |
|
54 | + public function gettingStarted(MarkdownParser $markdown, Cache $cache, Filesystem $file) |
|
55 | + { |
|
56 | + $gettingStarted = $cache->remember('getting-started', 5, function () use ($markdown, $file) { |
|
57 | + $gettingStarted = $file->get(base_path('resources/getting-started/readme.md')); |
|
58 | 58 | |
59 | - return $markdown->parse($gettingStarted); |
|
60 | - }); |
|
59 | + return $markdown->parse($gettingStarted); |
|
60 | + }); |
|
61 | 61 | |
62 | - return view('getting-started')->with(compact('gettingStarted')); |
|
63 | - } |
|
62 | + return view('getting-started')->with(compact('gettingStarted')); |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * Show the statistics screen to the user. |
|
67 | - * |
|
68 | - * @return Response |
|
69 | - */ |
|
70 | - public function statistics(Statistics $statistics) |
|
71 | - { |
|
72 | - $pokes_total = $statistics->totalPokes(); |
|
65 | + /** |
|
66 | + * Show the statistics screen to the user. |
|
67 | + * |
|
68 | + * @return Response |
|
69 | + */ |
|
70 | + public function statistics(Statistics $statistics) |
|
71 | + { |
|
72 | + $pokes_total = $statistics->totalPokes(); |
|
73 | 73 | |
74 | - $devices_total = $statistics->totalDevices(); |
|
74 | + $devices_total = $statistics->totalDevices(); |
|
75 | 75 | |
76 | - $pokes = $statistics->allPokes()->toArray(); |
|
76 | + $pokes = $statistics->allPokes()->toArray(); |
|
77 | 77 | |
78 | - $network_distribution = $statistics->networkDistribution()->toArray(); |
|
78 | + $network_distribution = $statistics->networkDistribution()->toArray(); |
|
79 | 79 | |
80 | - JavaScript::put(compact('pokes', 'network_distribution')); |
|
80 | + JavaScript::put(compact('pokes', 'network_distribution')); |
|
81 | 81 | |
82 | - return view('statistics')->with(compact('pokes_total', 'devices_total')); |
|
83 | - } |
|
82 | + return view('statistics')->with(compact('pokes_total', 'devices_total')); |
|
83 | + } |
|
84 | 84 | } |
@@ -7,41 +7,41 @@ |
||
7 | 7 | |
8 | 8 | class Authenticate |
9 | 9 | { |
10 | - /** |
|
11 | - * The Guard implementation. |
|
12 | - * |
|
13 | - * @var Guard |
|
14 | - */ |
|
15 | - protected $auth; |
|
10 | + /** |
|
11 | + * The Guard implementation. |
|
12 | + * |
|
13 | + * @var Guard |
|
14 | + */ |
|
15 | + protected $auth; |
|
16 | 16 | |
17 | - /** |
|
18 | - * Create a new filter instance. |
|
19 | - * |
|
20 | - * @param Guard $auth |
|
21 | - */ |
|
22 | - public function __construct(Guard $auth) |
|
23 | - { |
|
24 | - $this->auth = $auth; |
|
25 | - } |
|
17 | + /** |
|
18 | + * Create a new filter instance. |
|
19 | + * |
|
20 | + * @param Guard $auth |
|
21 | + */ |
|
22 | + public function __construct(Guard $auth) |
|
23 | + { |
|
24 | + $this->auth = $auth; |
|
25 | + } |
|
26 | 26 | |
27 | - /** |
|
28 | - * Handle an incoming request. |
|
29 | - * |
|
30 | - * @param \Illuminate\Http\Request $request |
|
31 | - * @param \Closure $next |
|
32 | - * |
|
33 | - * @return mixed |
|
34 | - */ |
|
35 | - public function handle($request, Closure $next) |
|
36 | - { |
|
37 | - if ($this->auth->guest()) { |
|
38 | - if ($request->ajax()) { |
|
39 | - return response('Unauthorized.', 401); |
|
40 | - } else { |
|
41 | - return redirect()->guest('auth/login'); |
|
42 | - } |
|
43 | - } |
|
27 | + /** |
|
28 | + * Handle an incoming request. |
|
29 | + * |
|
30 | + * @param \Illuminate\Http\Request $request |
|
31 | + * @param \Closure $next |
|
32 | + * |
|
33 | + * @return mixed |
|
34 | + */ |
|
35 | + public function handle($request, Closure $next) |
|
36 | + { |
|
37 | + if ($this->auth->guest()) { |
|
38 | + if ($request->ajax()) { |
|
39 | + return response('Unauthorized.', 401); |
|
40 | + } else { |
|
41 | + return redirect()->guest('auth/login'); |
|
42 | + } |
|
43 | + } |
|
44 | 44 | |
45 | - return $next($request); |
|
46 | - } |
|
45 | + return $next($request); |
|
46 | + } |
|
47 | 47 | } |
@@ -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'); |
@@ -6,5 +6,5 @@ |
||
6 | 6 | |
7 | 7 | class Poke extends Model |
8 | 8 | { |
9 | - protected $fillable = ['ip', 'mac']; |
|
9 | + protected $fillable = ['ip', 'mac']; |
|
10 | 10 | } |
@@ -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 | } |