Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
b0fcdaa375 | ||
|
55d369df47 | ||
|
c5413d5b50 |
@@ -18,7 +18,10 @@
|
|||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Leenooks\\": "src"
|
"Leenooks\\": "src"
|
||||||
}
|
},
|
||||||
|
"files": [
|
||||||
|
"src/helpers.php"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"laravel": {
|
"laravel": {
|
||||||
|
@@ -4,6 +4,16 @@
|
|||||||
<!-- Laravel App -->
|
<!-- Laravel App -->
|
||||||
<script src="{{ url(mix('/js/app.js')) }}" type="text/javascript"></script>
|
<script src="{{ url(mix('/js/app.js')) }}" type="text/javascript"></script>
|
||||||
|
|
||||||
|
<!-- Our our CSRF token to each interaction -->
|
||||||
|
{{-- @todo Test that we are validating this, also axios should be doing this for us? --}}
|
||||||
|
<script type="text/javascript">
|
||||||
|
$.ajaxSetup({
|
||||||
|
headers: {
|
||||||
|
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
<!-- Optionally, you can add Slimscroll and FastClick plugins.
|
<!-- Optionally, you can add Slimscroll and FastClick plugins.
|
||||||
Both of these plugins are recommended to enhance the
|
Both of these plugins are recommended to enhance the
|
||||||
user experience. Slimscroll is required when using the
|
user experience. Slimscroll is required when using the
|
||||||
|
66
src/Commands/ScheduleList.php
Normal file
66
src/Commands/ScheduleList.php
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Leenooks\Commands;
|
||||||
|
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Console\Scheduling\Schedule;
|
||||||
|
|
||||||
|
class ScheduleList extends Command
|
||||||
|
{
|
||||||
|
protected $signature = 'schedule:list';
|
||||||
|
|
||||||
|
protected $description = 'List when scheduled commands are executed.';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Schedule
|
||||||
|
*/
|
||||||
|
protected $schedule;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ScheduleList constructor.
|
||||||
|
*
|
||||||
|
* @param Schedule $schedule
|
||||||
|
*/
|
||||||
|
public function __construct(Schedule $schedule)
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
|
$this->schedule = $schedule;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the console command.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$events = array_map(function ($event) {
|
||||||
|
return [
|
||||||
|
'cron' => $event->expression,
|
||||||
|
'command' => static::fixupCommand($event->command),
|
||||||
|
];
|
||||||
|
}, $this->schedule->events());
|
||||||
|
|
||||||
|
$this->table(
|
||||||
|
['Cron', 'Command'],
|
||||||
|
$events
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If it's an artisan command, strip off the PHP
|
||||||
|
*
|
||||||
|
* @param $command
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected static function fixupCommand($command)
|
||||||
|
{
|
||||||
|
$parts = explode(' ', $command);
|
||||||
|
if (count($parts) > 2 && $parts[1] === "'artisan'") {
|
||||||
|
array_shift($parts);
|
||||||
|
}
|
||||||
|
|
||||||
|
return implode(' ', $parts);
|
||||||
|
}
|
||||||
|
}
|
@@ -44,7 +44,6 @@ class AdminController extends Controller
|
|||||||
return Redirect::to('/home');
|
return Redirect::to('/home');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function switch_authorised()
|
public function switch_authorised()
|
||||||
{
|
{
|
||||||
// @todo
|
// @todo
|
||||||
|
15
src/helpers.php
Normal file
15
src/helpers.php
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// is_json helper
|
||||||
|
if (! function_exists('is_json')) {
|
||||||
|
function is_json($string) {
|
||||||
|
try {
|
||||||
|
json_decode($string);
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (json_last_error() == JSON_ERROR_NONE);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user