mirror of
https://github.com/henrywhitaker3/Speedtest-Tracker.git
synced 2025-12-21 21:33:08 +01:00
Commented the code
This commit is contained in:
@@ -32,9 +32,9 @@ class SpeedtestCommand extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the console command.
|
* Runs a speedtest synchroonously and displays the results..
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return null
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,9 +33,9 @@ class SpeedtestLatestCommand extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the console command.
|
* Prints the latest speedtest values.
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return null
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,7 +9,14 @@ use Illuminate\Support\Facades\Log;
|
|||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
class BackupHelper {
|
class BackupHelper {
|
||||||
public static function backup($format = 'json')
|
|
||||||
|
/**
|
||||||
|
* Generates a backup of all speedtests.
|
||||||
|
*
|
||||||
|
* @param string $format json|csv
|
||||||
|
* @return string $name Returns the filename of the backup.
|
||||||
|
*/
|
||||||
|
public static function backup(String $format = 'json')
|
||||||
{
|
{
|
||||||
$timestamp = new DateTime();
|
$timestamp = new DateTime();
|
||||||
$timestamp = $timestamp->format('Y-m-d_H:i:s');
|
$timestamp = $timestamp->format('Y-m-d_H:i:s');
|
||||||
@@ -43,6 +50,13 @@ class BackupHelper {
|
|||||||
return $name;
|
return $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restore data from a backup in CSV or JSON format
|
||||||
|
*
|
||||||
|
* @param array|string $array Backup data
|
||||||
|
* @param string $format json|csv
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
public static function restore($array, $format)
|
public static function restore($array, $format)
|
||||||
{
|
{
|
||||||
if($format == 'json') {
|
if($format == 'json') {
|
||||||
|
|||||||
@@ -5,6 +5,13 @@ namespace App\Helpers;
|
|||||||
use App\Setting;
|
use App\Setting;
|
||||||
|
|
||||||
class SettingsHelper {
|
class SettingsHelper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a Setting object by name
|
||||||
|
*
|
||||||
|
* @param String $name The name field in the setting table
|
||||||
|
* @return \App\Setting|boolean $name The Setting object. Returns false if no mathcing obj.
|
||||||
|
*/
|
||||||
public static function get(String $name)
|
public static function get(String $name)
|
||||||
{
|
{
|
||||||
$name = Setting::where('name', $name)->get();
|
$name = Setting::where('name', $name)->get();
|
||||||
@@ -19,6 +26,13 @@ class SettingsHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create / update value for Setting object.
|
||||||
|
*
|
||||||
|
* @param String $name Name of setting
|
||||||
|
* @param String $value Value of setting
|
||||||
|
* @return \App\Setting
|
||||||
|
*/
|
||||||
public static function set(String $name, String $value)
|
public static function set(String $name, String $value)
|
||||||
{
|
{
|
||||||
$setting = SettingsHelper::get($name);
|
$setting = SettingsHelper::get($name);
|
||||||
@@ -36,6 +50,11 @@ class SettingsHelper {
|
|||||||
return $setting;
|
return $setting;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the app's base path
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public static function getBase()
|
public static function getBase()
|
||||||
{
|
{
|
||||||
$base = env('BASE_PATH', '/');
|
$base = env('BASE_PATH', '/');
|
||||||
|
|||||||
@@ -13,6 +13,13 @@ use JsonException;
|
|||||||
use SimpleXMLElement;
|
use SimpleXMLElement;
|
||||||
|
|
||||||
class SpeedtestHelper {
|
class SpeedtestHelper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs/processes speedtest output to created a Speedtest object
|
||||||
|
*
|
||||||
|
* @param boolean|string $output If false, new speedtest runs. If anything else, will try to parse as JSON for speedtest results.
|
||||||
|
* @return \App\Speedtest|boolean
|
||||||
|
*/
|
||||||
public static function runSpeedtest($output = false)
|
public static function runSpeedtest($output = false)
|
||||||
{
|
{
|
||||||
if($output === false) {
|
if($output === false) {
|
||||||
@@ -36,6 +43,11 @@ class SpeedtestHelper {
|
|||||||
return (isset($test)) ? $test : false;
|
return (isset($test)) ? $test : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the output of executing speedtest binary.
|
||||||
|
*
|
||||||
|
* @return boolean|string
|
||||||
|
*/
|
||||||
public static function output()
|
public static function output()
|
||||||
{
|
{
|
||||||
$server = SettingsHelper::get('server')['value'];
|
$server = SettingsHelper::get('server')['value'];
|
||||||
@@ -54,10 +66,21 @@ class SpeedtestHelper {
|
|||||||
return shell_exec($binPath . ' -f json');
|
return shell_exec($binPath . ' -f json');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts bytes/s to Mbps
|
||||||
|
*
|
||||||
|
* @param int|float $bytes
|
||||||
|
* @return int|float
|
||||||
|
*/
|
||||||
public static function convert($bytes) {
|
public static function convert($bytes) {
|
||||||
return ( $bytes * 8 ) / 1000000;
|
return ( $bytes * 8 ) / 1000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the latest speedtest object.
|
||||||
|
*
|
||||||
|
* @return boolean|\App\Speedtest
|
||||||
|
*/
|
||||||
public static function latest()
|
public static function latest()
|
||||||
{
|
{
|
||||||
$data = Speedtest::latest()->get();
|
$data = Speedtest::latest()->get();
|
||||||
@@ -69,6 +92,12 @@ class SpeedtestHelper {
|
|||||||
return $data->first();
|
return $data->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses network speeds and return converted to Mbps
|
||||||
|
*
|
||||||
|
* @param array $input
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public static function parseUnits($input)
|
public static function parseUnits($input)
|
||||||
{
|
{
|
||||||
$input = explode(' ', $input);
|
$input = explode(' ', $input);
|
||||||
|
|||||||
@@ -10,10 +10,39 @@ use RecursiveIteratorIterator;
|
|||||||
use ZipArchive;
|
use ZipArchive;
|
||||||
|
|
||||||
class UpdateHelper {
|
class UpdateHelper {
|
||||||
|
/**
|
||||||
|
* URL of updates
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $url;
|
public $url;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Current app version number
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $currentVersion;
|
public $currentVersion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Username of GitHub repo
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $user;
|
public $user;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of GitHub repo
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $repo;
|
public $repo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Branch of GitHub repo
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $branch;
|
public $branch;
|
||||||
|
|
||||||
function __construct() {
|
function __construct() {
|
||||||
@@ -25,6 +54,11 @@ class UpdateHelper {
|
|||||||
$this->download = null;
|
$this->download = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns data on new version available
|
||||||
|
*
|
||||||
|
* @return boolean|array false|[ version, changelog ]
|
||||||
|
*/
|
||||||
public function check()
|
public function check()
|
||||||
{
|
{
|
||||||
Log::info('Checking for new version');
|
Log::info('Checking for new version');
|
||||||
@@ -50,6 +84,11 @@ class UpdateHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the latest version number from GitHub
|
||||||
|
*
|
||||||
|
* @return array [ repo, branch, version ]
|
||||||
|
*/
|
||||||
public function checkLatestVersion()
|
public function checkLatestVersion()
|
||||||
{
|
{
|
||||||
$url = 'https://raw.githubusercontent.com/'
|
$url = 'https://raw.githubusercontent.com/'
|
||||||
@@ -78,6 +117,11 @@ class UpdateHelper {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the latest changelog from GitHub
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public function getChangelog()
|
public function getChangelog()
|
||||||
{
|
{
|
||||||
$url = 'https://raw.githubusercontent.com/'
|
$url = 'https://raw.githubusercontent.com/'
|
||||||
@@ -97,6 +141,11 @@ class UpdateHelper {
|
|||||||
return $changelog;
|
return $changelog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Downloads the latest version from GitHub
|
||||||
|
*
|
||||||
|
* @return boolean|Exception
|
||||||
|
*/
|
||||||
public function downloadLatest()
|
public function downloadLatest()
|
||||||
{
|
{
|
||||||
Log::info('Downloading the latest version from GitHub');
|
Log::info('Downloading the latest version from GitHub');
|
||||||
@@ -121,6 +170,11 @@ class UpdateHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extracts zip archive from update
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
public function extractFiles()
|
public function extractFiles()
|
||||||
{
|
{
|
||||||
Log::info('Extracting the update');
|
Log::info('Extracting the update');
|
||||||
@@ -137,6 +191,11 @@ class UpdateHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace existing files with newly downloaded files
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function updateFiles()
|
public function updateFiles()
|
||||||
{
|
{
|
||||||
Log::info('Applying update');
|
Log::info('Applying update');
|
||||||
@@ -151,6 +210,14 @@ class UpdateHelper {
|
|||||||
Log::info('Successfully applied update');
|
Log::info('Successfully applied update');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes default templates from updated files.
|
||||||
|
* This is for things like .env so that user specified files are not
|
||||||
|
* overwritten.
|
||||||
|
*
|
||||||
|
* @param string $path
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
private function deleteExcluded($path)
|
private function deleteExcluded($path)
|
||||||
{
|
{
|
||||||
Log::info('Deleting excluded items from update directory');
|
Log::info('Deleting excluded items from update directory');
|
||||||
@@ -172,6 +239,11 @@ class UpdateHelper {
|
|||||||
Log::info('Excluded items deleted from update directory');
|
Log::info('Excluded items deleted from update directory');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a ZIP backup of current installation
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
private function backupCurrent()
|
private function backupCurrent()
|
||||||
{
|
{
|
||||||
Log::info('Backing up current installation');
|
Log::info('Backing up current installation');
|
||||||
@@ -209,6 +281,11 @@ class UpdateHelper {
|
|||||||
Log::info('Backup created at: ' . $backupZip);
|
Log::info('Backup created at: ' . $backupZip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move updated files into server dir.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
private function moveFiles()
|
private function moveFiles()
|
||||||
{
|
{
|
||||||
$new = array_filter(glob('/tmp/'.$this->repo.'-update/*'), 'is_dir');
|
$new = array_filter(glob('/tmp/'.$this->repo.'-update/*'), 'is_dir');
|
||||||
@@ -242,6 +319,11 @@ class UpdateHelper {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make a copy of excluded, user customised files
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
private function tempStoreExcludedFiles()
|
private function tempStoreExcludedFiles()
|
||||||
{
|
{
|
||||||
Log::info('Temporarily moving exluded files from root directory');
|
Log::info('Temporarily moving exluded files from root directory');
|
||||||
@@ -263,6 +345,11 @@ class UpdateHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restore user cusotmised files from the copy
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
private function restoreExcludedFiles()
|
private function restoreExcludedFiles()
|
||||||
{
|
{
|
||||||
Log::info('Restoring exluded files to root directory');
|
Log::info('Restoring exluded files to root directory');
|
||||||
@@ -284,6 +371,11 @@ class UpdateHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete update files from download dir.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
private function clearup()
|
private function clearup()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -10,6 +10,13 @@ use Illuminate\Support\Facades\Validator;
|
|||||||
|
|
||||||
class BackupController extends Controller
|
class BackupController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get backup of speedtests
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @return file
|
||||||
|
*/
|
||||||
public function backup(Request $request)
|
public function backup(Request $request)
|
||||||
{
|
{
|
||||||
$validator = Validator::make($request->all(), [ 'format' => 'in:json,csv' ]);
|
$validator = Validator::make($request->all(), [ 'format' => 'in:json,csv' ]);
|
||||||
@@ -25,6 +32,12 @@ class BackupController extends Controller
|
|||||||
return Storage::disk('local')->download($filename);
|
return Storage::disk('local')->download($filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retore from a backup
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
public function restore(Request $request)
|
public function restore(Request $request)
|
||||||
{
|
{
|
||||||
$rule = [
|
$rule = [
|
||||||
|
|||||||
@@ -10,16 +10,34 @@ use Illuminate\Support\Facades\Validator;
|
|||||||
|
|
||||||
class SettingsController extends Controller
|
class SettingsController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all settings
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
return Setting::get()->keyBy('name');
|
return Setting::get()->keyBy('name');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get setting by id
|
||||||
|
*
|
||||||
|
* @param Setting $setting
|
||||||
|
* @return Setting
|
||||||
|
*/
|
||||||
public function get(Setting $setting)
|
public function get(Setting $setting)
|
||||||
{
|
{
|
||||||
return $setting;
|
return $setting;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store/update a setting
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
$rule = [
|
$rule = [
|
||||||
@@ -49,6 +67,11 @@ class SettingsController extends Controller
|
|||||||
], 200);
|
], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns instance config
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public function config()
|
public function config()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,12 @@ use Illuminate\Support\Facades\Validator;
|
|||||||
|
|
||||||
class SpeedtestController extends Controller
|
class SpeedtestController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns paginated list of speedtests
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$data = Speedtest::orderBy('created_at', 'desc')
|
$data = Speedtest::orderBy('created_at', 'desc')
|
||||||
@@ -24,6 +30,12 @@ class SpeedtestController extends Controller
|
|||||||
], 200);
|
], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns speedtest going back 'x' days
|
||||||
|
*
|
||||||
|
* @param int $days
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function time($days)
|
public function time($days)
|
||||||
{
|
{
|
||||||
$rule = [
|
$rule = [
|
||||||
@@ -50,6 +62,11 @@ class SpeedtestController extends Controller
|
|||||||
], 200);
|
], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return latest speedtest
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
public function latest()
|
public function latest()
|
||||||
{
|
{
|
||||||
$data = SpeedtestHelper::latest();
|
$data = SpeedtestHelper::latest();
|
||||||
@@ -73,6 +90,11 @@ class SpeedtestController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Queue a new speedtest
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -8,6 +8,12 @@ use Illuminate\Http\Request;
|
|||||||
|
|
||||||
class UpdateController extends Controller
|
class UpdateController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check for new update
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
public function checkForUpdate()
|
public function checkForUpdate()
|
||||||
{
|
{
|
||||||
return response()->json([
|
return response()->json([
|
||||||
@@ -16,6 +22,11 @@ class UpdateController extends Controller
|
|||||||
], 200);
|
], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Download new update
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
public function downloadUpdate()
|
public function downloadUpdate()
|
||||||
{
|
{
|
||||||
$dl = Updater::downloadLatest();
|
$dl = Updater::downloadLatest();
|
||||||
@@ -33,6 +44,11 @@ class UpdateController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trigger update extraction
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
public function extractUpdate()
|
public function extractUpdate()
|
||||||
{
|
{
|
||||||
$ex = Updater::extractFiles();
|
$ex = Updater::extractFiles();
|
||||||
@@ -50,6 +66,11 @@ class UpdateController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trigger update file move
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
public function moveUpdate()
|
public function moveUpdate()
|
||||||
{
|
{
|
||||||
$cp = Updater::updateFiles();
|
$cp = Updater::updateFiles();
|
||||||
@@ -60,6 +81,11 @@ class UpdateController extends Controller
|
|||||||
], 200);
|
], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get local changelog
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
public function changelog()
|
public function changelog()
|
||||||
{
|
{
|
||||||
$url = base_path() . '/changelog.json';
|
$url = base_path() . '/changelog.json';
|
||||||
|
|||||||
@@ -25,9 +25,9 @@ class SpeedtestJob implements ShouldQueue
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the job.
|
* Runs a speedtest
|
||||||
*
|
*
|
||||||
* @return void
|
* @return \App\Speedtest
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class SpeedtestCompleteListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the event.
|
* Handle what to do after speedtest completes
|
||||||
*
|
*
|
||||||
* @param object $event
|
* @param object $event
|
||||||
* @return void
|
* @return void
|
||||||
|
|||||||
@@ -34,6 +34,12 @@ class SpeedtestComplete extends Notification
|
|||||||
return ['slack'];
|
return ['slack'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format slack notification
|
||||||
|
*
|
||||||
|
* @param mixed $notifiable
|
||||||
|
* @return SlackMessage
|
||||||
|
*/
|
||||||
public function toSlack($notifiable)
|
public function toSlack($notifiable)
|
||||||
{
|
{
|
||||||
$speedtest = $this->speedtest;
|
$speedtest = $this->speedtest;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class Cron implements Rule
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if the validation rule passes.
|
* Determine if the value is a valid CRON expression
|
||||||
*
|
*
|
||||||
* @param string $attribute
|
* @param string $attribute
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
|
|||||||
@@ -75,6 +75,11 @@ class User extends Authenticatable implements JWTSubject
|
|||||||
return $this->hasOne('\App\Auth\EmailVerification');
|
return $this->hasOne('\App\Auth\EmailVerification');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a user's login sessions
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public function sessions()
|
public function sessions()
|
||||||
{
|
{
|
||||||
return $this->hasMany('\App\Auth\LoginSession');
|
return $this->hasMany('\App\Auth\LoginSession');
|
||||||
|
|||||||
Reference in New Issue
Block a user