Compare commits

..

5 Commits
0.1.2 ... 0.1.6

Author SHA1 Message Date
Deon George
b0fcdaa375 Added artisan command schedule:list 2018-06-15 14:14:04 +10:00
Deon George
55d369df47 Added helpers.php 2018-06-12 16:09:27 +10:00
Deon George
c5413d5b50 Added X-CSRF-TOKEN 2018-06-05 23:39:47 +10:00
Deon George
8bafc735c4 Moved page-scripts to render after main scripts 2018-05-24 12:28:30 +10:00
Deon George
1bfd5609a5 Using @js instead of script, minor fixes 2018-05-22 22:09:18 +10:00
8 changed files with 103 additions and 14 deletions

View File

@@ -18,7 +18,10 @@
"autoload": {
"psr-4": {
"Leenooks\\": "src"
}
},
"files": [
"src/helpers.php"
]
},
"extra": {
"laravel": {

View File

@@ -36,6 +36,9 @@
@include('adminlte::layouts.partials.scripts')
{{-- Scripts --}}
{!! Asset::scripts() !!}
@yield('page-scripts')
@show
</body>
</html>

View File

@@ -29,13 +29,7 @@
echo json_encode($trans);
@endphp
</script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<style>
#favourite.selected {
color: orange;
}
</style>
<!-- STYLESHEETS -->
{!! Asset::styles() !!}
</head>
</head>

View File

@@ -2,12 +2,21 @@
<!-- JQuery and bootstrap are required by Laravel 5.3 in resources/assets/js/bootstrap.js-->
<!-- 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>
@yield('page-scripts')
<!-- Optionally, you can add Slimscroll and FastClick plugins.
Both of these plugins are recommended to enhance the
user experience. Slimscroll is required when using the
fixed layout. -->
@js('site/js/jquery.slimscroll.min.js','jq.slimscroll');
@js('site/js/fastclick.min.js','jq.fastclick');
@js('/site/js/jquery.slimscroll.min.js','jq.slimscroll');
@js('/site/js/fastclick.min.js','jq.fastclick');

View File

@@ -37,7 +37,7 @@
</aside>
@section('page-scripts')
<script src="{{ url('/plugins/bootstrap3-typeahead.min.js') }}"></script>
@js('/site/js/bootstrap3-typeahead.min.js','bs-typeahead')
<script type="text/javascript">
$(document).ready(function() {

View 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);
}
}

View File

@@ -44,7 +44,6 @@ class AdminController extends Controller
return Redirect::to('/home');
}
public function switch_authorised()
{
// @todo

15
src/helpers.php Normal file
View 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);
}
}