@@ -10,7 +10,7 @@ |
||
| 10 | 10 | /** |
| 11 | 11 | * Returns the count of all pokes. |
| 12 | 12 | * |
| 13 | - * @return mixed |
|
| 13 | + * @return integer |
|
| 14 | 14 | */ |
| 15 | 15 | public function totalPokes() |
| 16 | 16 | { |
@@ -9,60 +9,60 @@ |
||
| 9 | 9 | |
| 10 | 10 | class Statistics |
| 11 | 11 | { |
| 12 | - /** |
|
| 13 | - * Returns the count of all pokes. |
|
| 14 | - * |
|
| 15 | - * @return mixed |
|
| 16 | - */ |
|
| 17 | - public function totalPokes() |
|
| 18 | - { |
|
| 19 | - $base = 189771; |
|
| 12 | + /** |
|
| 13 | + * Returns the count of all pokes. |
|
| 14 | + * |
|
| 15 | + * @return mixed |
|
| 16 | + */ |
|
| 17 | + public function totalPokes() |
|
| 18 | + { |
|
| 19 | + $base = 189771; |
|
| 20 | 20 | |
| 21 | - return DB::table('network_distribution')->sum('pokes') + $base; |
|
| 22 | - } |
|
| 21 | + return DB::table('network_distribution')->sum('pokes') + $base; |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Returns the the count of all devices. |
|
| 26 | - * |
|
| 27 | - * @return mixed |
|
| 28 | - */ |
|
| 29 | - public function totalDevices() |
|
| 30 | - { |
|
| 31 | - return DeviceArchive::count(); |
|
| 32 | - } |
|
| 24 | + /** |
|
| 25 | + * Returns the the count of all devices. |
|
| 26 | + * |
|
| 27 | + * @return mixed |
|
| 28 | + */ |
|
| 29 | + public function totalDevices() |
|
| 30 | + { |
|
| 31 | + return DeviceArchive::count(); |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Returns all pokes. |
|
| 36 | - * |
|
| 37 | - * @return mixed |
|
| 38 | - */ |
|
| 39 | - public function allPokes() |
|
| 40 | - { |
|
| 41 | - return Poke::all(); |
|
| 42 | - } |
|
| 34 | + /** |
|
| 35 | + * Returns all pokes. |
|
| 36 | + * |
|
| 37 | + * @return mixed |
|
| 38 | + */ |
|
| 39 | + public function allPokes() |
|
| 40 | + { |
|
| 41 | + return Poke::all(); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Returns a collection of all networks and it's count. |
|
| 46 | - * |
|
| 47 | - * @return mixed |
|
| 48 | - */ |
|
| 49 | - public function networkDistribution() |
|
| 50 | - { |
|
| 51 | - $data = DB::table('network_distribution') |
|
| 52 | - ->select('network as label', 'pokes as value') |
|
| 53 | - ->get(); |
|
| 44 | + /** |
|
| 45 | + * Returns a collection of all networks and it's count. |
|
| 46 | + * |
|
| 47 | + * @return mixed |
|
| 48 | + */ |
|
| 49 | + public function networkDistribution() |
|
| 50 | + { |
|
| 51 | + $data = DB::table('network_distribution') |
|
| 52 | + ->select('network as label', 'pokes as value') |
|
| 53 | + ->get(); |
|
| 54 | 54 | |
| 55 | - return $this->addColors($data); |
|
| 56 | - } |
|
| 55 | + return $this->addColors($data); |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - private function addColors($data) |
|
| 59 | - { |
|
| 60 | - $colors = ['rgb(23,103,153)', 'rgb(47,135,176)', 'rgb(66,164,187)', 'rgb(91,192,196)']; |
|
| 61 | - $highlight_colors = ['#8BB3CC', '#97C3D7', '#ADDFE1', '#BBEAE3']; |
|
| 58 | + private function addColors($data) |
|
| 59 | + { |
|
| 60 | + $colors = ['rgb(23,103,153)', 'rgb(47,135,176)', 'rgb(66,164,187)', 'rgb(91,192,196)']; |
|
| 61 | + $highlight_colors = ['#8BB3CC', '#97C3D7', '#ADDFE1', '#BBEAE3']; |
|
| 62 | 62 | |
| 63 | - return $data->each(function ($network, $i) use ($colors, $highlight_colors) { |
|
| 64 | - $network->color = $colors[$i]; |
|
| 65 | - $network->highlight = $highlight_colors[$i]; |
|
| 66 | - }); |
|
| 67 | - } |
|
| 63 | + return $data->each(function ($network, $i) use ($colors, $highlight_colors) { |
|
| 64 | + $network->color = $colors[$i]; |
|
| 65 | + $network->highlight = $highlight_colors[$i]; |
|
| 66 | + }); |
|
| 67 | + } |
|
| 68 | 68 | } |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | $colors = ['rgb(23,103,153)', 'rgb(47,135,176)', 'rgb(66,164,187)', 'rgb(91,192,196)']; |
| 61 | 61 | $highlight_colors = ['#8BB3CC', '#97C3D7', '#ADDFE1', '#BBEAE3']; |
| 62 | 62 | |
| 63 | - return $data->each(function ($network, $i) use ($colors, $highlight_colors) { |
|
| 63 | + return $data->each(function($network, $i) use ($colors, $highlight_colors) { |
|
| 64 | 64 | $network->color = $colors[$i]; |
| 65 | 65 | $network->highlight = $highlight_colors[$i]; |
| 66 | 66 | }); |
@@ -8,71 +8,71 @@ |
||
| 8 | 8 | |
| 9 | 9 | class FlushOldDevices extends Command |
| 10 | 10 | { |
| 11 | - /** |
|
| 12 | - * The console command name. |
|
| 13 | - * |
|
| 14 | - * @var string |
|
| 15 | - */ |
|
| 16 | - protected $name = 'pi:flush'; |
|
| 11 | + /** |
|
| 12 | + * The console command name. |
|
| 13 | + * |
|
| 14 | + * @var string |
|
| 15 | + */ |
|
| 16 | + protected $name = 'pi:flush'; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * The console command description. |
|
| 20 | - * |
|
| 21 | - * @var string |
|
| 22 | - */ |
|
| 23 | - protected $description = 'Remove all devices from the list which don\'t poked us in the last 15 minutes.'; |
|
| 18 | + /** |
|
| 19 | + * The console command description. |
|
| 20 | + * |
|
| 21 | + * @var string |
|
| 22 | + */ |
|
| 23 | + protected $description = 'Remove all devices from the list which don\'t poked us in the last 15 minutes.'; |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Create a new command instance. |
|
| 27 | - */ |
|
| 28 | - public function __construct() |
|
| 29 | - { |
|
| 30 | - parent::__construct(); |
|
| 31 | - } |
|
| 25 | + /** |
|
| 26 | + * Create a new command instance. |
|
| 27 | + */ |
|
| 28 | + public function __construct() |
|
| 29 | + { |
|
| 30 | + parent::__construct(); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * Execute the console command. |
|
| 35 | - * |
|
| 36 | - * @return mixed |
|
| 37 | - */ |
|
| 38 | - public function fire() |
|
| 39 | - { |
|
| 40 | - $affectedRows = $this->getDevices(); |
|
| 33 | + /** |
|
| 34 | + * Execute the console command. |
|
| 35 | + * |
|
| 36 | + * @return mixed |
|
| 37 | + */ |
|
| 38 | + public function fire() |
|
| 39 | + { |
|
| 40 | + $affectedRows = $this->getDevices(); |
|
| 41 | 41 | |
| 42 | - $message = $this->getMessage($affectedRows); |
|
| 42 | + $message = $this->getMessage($affectedRows); |
|
| 43 | 43 | |
| 44 | - $this->info($message); |
|
| 45 | - } |
|
| 44 | + $this->info($message); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * @param $affectedRows |
|
| 49 | - * |
|
| 50 | - * @return string |
|
| 51 | - */ |
|
| 52 | - public function getMessage($affectedRows) |
|
| 53 | - { |
|
| 54 | - $message = "Deleted $affectedRows device".($affectedRows == 1 ? '' : 's').'.'; |
|
| 47 | + /** |
|
| 48 | + * @param $affectedRows |
|
| 49 | + * |
|
| 50 | + * @return string |
|
| 51 | + */ |
|
| 52 | + public function getMessage($affectedRows) |
|
| 53 | + { |
|
| 54 | + $message = "Deleted $affectedRows device".($affectedRows == 1 ? '' : 's').'.'; |
|
| 55 | 55 | |
| 56 | - return $message; |
|
| 57 | - } |
|
| 56 | + return $message; |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * Get all devices which should get deleted. |
|
| 61 | - * |
|
| 62 | - * @return mixed |
|
| 63 | - */ |
|
| 64 | - public function getDevices() |
|
| 65 | - { |
|
| 66 | - $date = Carbon::now()->subMinutes(15); |
|
| 59 | + /** |
|
| 60 | + * Get all devices which should get deleted. |
|
| 61 | + * |
|
| 62 | + * @return mixed |
|
| 63 | + */ |
|
| 64 | + public function getDevices() |
|
| 65 | + { |
|
| 66 | + $date = Carbon::now()->subMinutes(15); |
|
| 67 | 67 | |
| 68 | - $devices = Device::where('updated_at', '<', $date)->get(); |
|
| 68 | + $devices = Device::where('updated_at', '<', $date)->get(); |
|
| 69 | 69 | |
| 70 | - $affectedRows = $devices->count(); |
|
| 70 | + $affectedRows = $devices->count(); |
|
| 71 | 71 | |
| 72 | - foreach ($devices as $device) { |
|
| 73 | - $device->delete(); |
|
| 74 | - } |
|
| 72 | + foreach ($devices as $device) { |
|
| 73 | + $device->delete(); |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - return $affectedRows; |
|
| 77 | - } |
|
| 76 | + return $affectedRows; |
|
| 77 | + } |
|
| 78 | 78 | } |
@@ -9,48 +9,48 @@ |
||
| 9 | 9 | |
| 10 | 10 | class UserDelete extends Command |
| 11 | 11 | { |
| 12 | - /** |
|
| 13 | - * The console command name. |
|
| 14 | - * |
|
| 15 | - * @var string |
|
| 16 | - */ |
|
| 17 | - protected $name = 'user:delete'; |
|
| 18 | - |
|
| 19 | - /** |
|
| 20 | - * The console command description. |
|
| 21 | - * |
|
| 22 | - * @var string |
|
| 23 | - */ |
|
| 24 | - protected $description = 'Delete a user.'; |
|
| 25 | - |
|
| 26 | - /** |
|
| 27 | - * Execute the console command. |
|
| 28 | - * |
|
| 29 | - * @return mixed |
|
| 30 | - */ |
|
| 31 | - public function fire() |
|
| 32 | - { |
|
| 33 | - $email = $this->argument('email'); |
|
| 34 | - |
|
| 35 | - try { |
|
| 36 | - $user = User::whereEmail($email)->firstOrFail(); |
|
| 37 | - $user->delete(); |
|
| 38 | - |
|
| 39 | - $this->info('User deleted.'); |
|
| 40 | - } catch (ModelNotFoundException $e) { |
|
| 41 | - $this->error('Did not find a user with the given email address'); |
|
| 42 | - } |
|
| 43 | - } |
|
| 44 | - |
|
| 45 | - /** |
|
| 46 | - * Get the console command arguments. |
|
| 47 | - * |
|
| 48 | - * @return array |
|
| 49 | - */ |
|
| 50 | - protected function getArguments() |
|
| 51 | - { |
|
| 52 | - return [ |
|
| 53 | - ['email', InputArgument::REQUIRED, 'The email address of the user.'], |
|
| 54 | - ]; |
|
| 55 | - } |
|
| 12 | + /** |
|
| 13 | + * The console command name. |
|
| 14 | + * |
|
| 15 | + * @var string |
|
| 16 | + */ |
|
| 17 | + protected $name = 'user:delete'; |
|
| 18 | + |
|
| 19 | + /** |
|
| 20 | + * The console command description. |
|
| 21 | + * |
|
| 22 | + * @var string |
|
| 23 | + */ |
|
| 24 | + protected $description = 'Delete a user.'; |
|
| 25 | + |
|
| 26 | + /** |
|
| 27 | + * Execute the console command. |
|
| 28 | + * |
|
| 29 | + * @return mixed |
|
| 30 | + */ |
|
| 31 | + public function fire() |
|
| 32 | + { |
|
| 33 | + $email = $this->argument('email'); |
|
| 34 | + |
|
| 35 | + try { |
|
| 36 | + $user = User::whereEmail($email)->firstOrFail(); |
|
| 37 | + $user->delete(); |
|
| 38 | + |
|
| 39 | + $this->info('User deleted.'); |
|
| 40 | + } catch (ModelNotFoundException $e) { |
|
| 41 | + $this->error('Did not find a user with the given email address'); |
|
| 42 | + } |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + /** |
|
| 46 | + * Get the console command arguments. |
|
| 47 | + * |
|
| 48 | + * @return array |
|
| 49 | + */ |
|
| 50 | + protected function getArguments() |
|
| 51 | + { |
|
| 52 | + return [ |
|
| 53 | + ['email', InputArgument::REQUIRED, 'The email address of the user.'], |
|
| 54 | + ]; |
|
| 55 | + } |
|
| 56 | 56 | } |
@@ -7,25 +7,25 @@ |
||
| 7 | 7 | |
| 8 | 8 | class Kernel extends ConsoleKernel |
| 9 | 9 | { |
| 10 | - /** |
|
| 11 | - * The Artisan commands provided by your application. |
|
| 12 | - * |
|
| 13 | - * @var array |
|
| 14 | - */ |
|
| 15 | - protected $commands = [ |
|
| 16 | - 'PiFinder\Console\Commands\FlushOldDevices', |
|
| 17 | - 'PiFinder\Console\Commands\UserCreate', |
|
| 18 | - 'PiFinder\Console\Commands\UserDelete', |
|
| 19 | - ]; |
|
| 10 | + /** |
|
| 11 | + * The Artisan commands provided by your application. |
|
| 12 | + * |
|
| 13 | + * @var array |
|
| 14 | + */ |
|
| 15 | + protected $commands = [ |
|
| 16 | + 'PiFinder\Console\Commands\FlushOldDevices', |
|
| 17 | + 'PiFinder\Console\Commands\UserCreate', |
|
| 18 | + 'PiFinder\Console\Commands\UserDelete', |
|
| 19 | + ]; |
|
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * Define the application's command schedule. |
|
| 23 | - * |
|
| 24 | - * @param \Illuminate\Console\Scheduling\Schedule $schedule |
|
| 25 | - */ |
|
| 26 | - protected function schedule(Schedule $schedule) |
|
| 27 | - { |
|
| 28 | - $schedule->command('pi:flush') |
|
| 29 | - ->everyFiveMinutes(); |
|
| 30 | - } |
|
| 21 | + /** |
|
| 22 | + * Define the application's command schedule. |
|
| 23 | + * |
|
| 24 | + * @param \Illuminate\Console\Scheduling\Schedule $schedule |
|
| 25 | + */ |
|
| 26 | + protected function schedule(Schedule $schedule) |
|
| 27 | + { |
|
| 28 | + $schedule->command('pi:flush') |
|
| 29 | + ->everyFiveMinutes(); |
|
| 30 | + } |
|
| 31 | 31 | } |
@@ -6,19 +6,19 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Device extends Model |
| 8 | 8 | { |
| 9 | - protected $fillable = ['ip', 'name', 'mac', 'public', 'group']; |
|
| 9 | + protected $fillable = ['ip', 'name', 'mac', 'public', 'group']; |
|
| 10 | 10 | |
| 11 | - public function scopeOnHomePage($query) |
|
| 12 | - { |
|
| 13 | - return $query->where('public', 'true') |
|
| 14 | - ->orWhere(function ($query) { |
|
| 15 | - $query->where('public', 'auto') |
|
| 16 | - ->whereNull('group'); |
|
| 17 | - }); |
|
| 18 | - } |
|
| 11 | + public function scopeOnHomePage($query) |
|
| 12 | + { |
|
| 13 | + return $query->where('public', 'true') |
|
| 14 | + ->orWhere(function ($query) { |
|
| 15 | + $query->where('public', 'auto') |
|
| 16 | + ->whereNull('group'); |
|
| 17 | + }); |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | - public function isPublic() |
|
| 21 | - { |
|
| 22 | - return $this->public == 'true' || ($this->public == 'auto' && $this->group === null); |
|
| 23 | - } |
|
| 20 | + public function isPublic() |
|
| 21 | + { |
|
| 22 | + return $this->public == 'true' || ($this->public == 'auto' && $this->group === null); |
|
| 23 | + } |
|
| 24 | 24 | } |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | public function scopeOnHomePage($query) |
| 12 | 12 | { |
| 13 | 13 | return $query->where('public', 'true') |
| 14 | - ->orWhere(function ($query) { |
|
| 14 | + ->orWhere(function($query) { |
|
| 15 | 15 | $query->where('public', 'auto') |
| 16 | 16 | ->whereNull('group'); |
| 17 | 17 | }); |
@@ -4,5 +4,5 @@ |
||
| 4 | 4 | |
| 5 | 5 | abstract class Event |
| 6 | 6 | { |
| 7 | - // |
|
| 7 | + // |
|
| 8 | 8 | } |
@@ -7,29 +7,29 @@ |
||
| 7 | 7 | |
| 8 | 8 | class ServerWasPoked extends Event |
| 9 | 9 | { |
| 10 | - use SerializesModels; |
|
| 10 | + use SerializesModels; |
|
| 11 | 11 | |
| 12 | - /** |
|
| 13 | - * @var Device |
|
| 14 | - */ |
|
| 15 | - protected $device; |
|
| 12 | + /** |
|
| 13 | + * @var Device |
|
| 14 | + */ |
|
| 15 | + protected $device; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * Create a new event instance. |
|
| 19 | - * |
|
| 20 | - * @param Device $device |
|
| 21 | - */ |
|
| 22 | - public function __construct(Device $device) |
|
| 23 | - { |
|
| 24 | - // |
|
| 25 | - $this->device = $device; |
|
| 26 | - } |
|
| 17 | + /** |
|
| 18 | + * Create a new event instance. |
|
| 19 | + * |
|
| 20 | + * @param Device $device |
|
| 21 | + */ |
|
| 22 | + public function __construct(Device $device) |
|
| 23 | + { |
|
| 24 | + // |
|
| 25 | + $this->device = $device; |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * @return Device |
|
| 30 | - */ |
|
| 31 | - public function getDevice() |
|
| 32 | - { |
|
| 33 | - return $this->device; |
|
| 34 | - } |
|
| 28 | + /** |
|
| 29 | + * @return Device |
|
| 30 | + */ |
|
| 31 | + public function getDevice() |
|
| 32 | + { |
|
| 33 | + return $this->device; |
|
| 34 | + } |
|
| 35 | 35 | } |
@@ -6,17 +6,17 @@ |
||
| 6 | 6 | |
| 7 | 7 | class GroupController extends Controller |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Show all Devices for the given group. |
|
| 11 | - * |
|
| 12 | - * @param string $group |
|
| 13 | - * |
|
| 14 | - * @return Response |
|
| 15 | - */ |
|
| 16 | - public function show($group) |
|
| 17 | - { |
|
| 18 | - $devices = Device::where('group', $group)->get(); |
|
| 9 | + /** |
|
| 10 | + * Show all Devices for the given group. |
|
| 11 | + * |
|
| 12 | + * @param string $group |
|
| 13 | + * |
|
| 14 | + * @return Response |
|
| 15 | + */ |
|
| 16 | + public function show($group) |
|
| 17 | + { |
|
| 18 | + $devices = Device::where('group', $group)->get(); |
|
| 19 | 19 | |
| 20 | - return view('overview')->with(compact('devices', 'group')); |
|
| 21 | - } |
|
| 20 | + return view('overview')->with(compact('devices', 'group')); |
|
| 21 | + } |
|
| 22 | 22 | } |
@@ -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 | } |