Compare commits
14 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
3af5ae6466 | ||
|
f8d7432965 | ||
|
98b7b9f6a8 | ||
|
f1787aaa32 | ||
|
0bd32aab4a | ||
|
444c159ab9 | ||
|
55cbe4087c | ||
|
ac867a2526 | ||
|
b0fcdaa375 | ||
|
55d369df47 | ||
|
c5413d5b50 | ||
|
8bafc735c4 | ||
|
1bfd5609a5 | ||
|
602fc14760 |
@@ -10,13 +10,18 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"igaster/laravel-theme": "2.0.6",
|
||||
"orchestra/asset": "^3.6"
|
||||
},
|
||||
"require-dev": {
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Leenooks\\": "src"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"src/helpers.php"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
|
6
readme.md
Normal file
6
readme.md
Normal file
@@ -0,0 +1,6 @@
|
||||
* User Switch
|
||||
Add the following routes
|
||||
```
|
||||
Route::get( 'admin/switch/start/{id}', 'UserController@user_switch_start' );
|
||||
Route::get( 'admin/switch/stop', 'UserController@user_switch_stop' );
|
||||
```
|
@@ -24,7 +24,7 @@ return [
|
||||
'conditions' => 'Terms and conditions',
|
||||
'register' => 'Register',
|
||||
'login' => 'Login',
|
||||
'membreship' => 'I already have a membership',
|
||||
'membership' => 'I already have a membership',
|
||||
'passwordclickreset' => 'Click here to reset your password:',
|
||||
'signGithub' => 'Sign in using Github',
|
||||
'signFacebook' => 'Sign in using Facebook',
|
||||
@@ -51,35 +51,21 @@ return [
|
||||
'level' => 'Level',
|
||||
'here' => 'Here',
|
||||
'recentactivity' => 'Recent Activity',
|
||||
'descriptionpackage' => 'A Laravel 5 package that switchs default Laravel scaffolding/boilerplate to AdminLTE template',
|
||||
'createdby' => 'Created by',
|
||||
'seecode' => 'See code at',
|
||||
'online' => 'Online',
|
||||
'home' => 'Home',
|
||||
'header' => 'HEADER',
|
||||
'anotherlink' => 'Another Link',
|
||||
'multilevel' => 'Multilevel',
|
||||
'linklevel2' => 'Link in level2',
|
||||
'birthday' => 'Langdon\'s Birthday',
|
||||
'birthdaydate' => 'Will be 23 on April 24th',
|
||||
'progress' => 'Tasks Progress',
|
||||
'customtemplate' => 'Custom Template Design',
|
||||
'statstab' => 'Stats Tab Content',
|
||||
'generalset' => 'General Settings',
|
||||
'reportpanel' => 'Report panel usage',
|
||||
'checked' => 'checked',
|
||||
'informationsettings' => 'Some information about this general settings option',
|
||||
'togglenav' => 'Toggle navigation',
|
||||
'tabmessages' => 'You have 4 messages',
|
||||
'supteam' => 'Support Team',
|
||||
'awesometheme' => 'Why not buy a new awesome theme?',
|
||||
'allmessages' => 'See All Messages',
|
||||
'notifications' => 'You have 10 notifications',
|
||||
'newmembers' => '5 new members joined today',
|
||||
'viewall' => 'View all',
|
||||
'tasks' => 'You have 9 tasks',
|
||||
'alltasks' => 'View all tasks',
|
||||
'desbuttons' => 'Design some buttons',
|
||||
'complete' => 'Complete',
|
||||
'membersince' => 'Member since',
|
||||
'followers' => 'Followers',
|
||||
@@ -87,26 +73,15 @@ return [
|
||||
'friends' => 'Friends',
|
||||
'profile' => 'Profile',
|
||||
'signout' => 'Sign out',
|
||||
'landingdescription' => 'Laravel 5 package that switchs default Laravel scaffolding/boilerplate to AdminLTE template with Bootstrap 3.0 and Pratt Landing page',
|
||||
'landingdescriptionpratt' => 'Acacha AdminLTE Laravel package template Landing page - Using Pratt',
|
||||
'description' => 'Description',
|
||||
'showcase' => 'Showcase',
|
||||
'contact' => 'Contact',
|
||||
'laravelpackage' => '5 package that switchs default Laravel',
|
||||
'to' => 'to',
|
||||
'templatewith' => 'template with',
|
||||
'and' => 'and',
|
||||
'gedstarted' => 'Get Started!',
|
||||
'amazing' => 'Amazing admin template',
|
||||
'basedadminlte' => 'Based on adminlte bootstrap theme',
|
||||
'awesomepackaged' => 'Awesome packaged...',
|
||||
'by' => 'by',
|
||||
'at' => 'at',
|
||||
'readytouse' => 'ready to use with Laravel!',
|
||||
'designed' => 'Designed To Excel',
|
||||
'community' => 'Community',
|
||||
'see' => 'See',
|
||||
'githubproject' => 'Github project',
|
||||
'post' => 'post',
|
||||
'issues' => 'issues',
|
||||
'pullrequests' => 'Pull requests',
|
||||
@@ -114,10 +89,6 @@ return [
|
||||
'monitoring' => 'Monitoring',
|
||||
'whatnew' => 'What\'s New?',
|
||||
'features' => 'Some Features',
|
||||
'design' => 'First Class Design',
|
||||
'retina' => 'Retina Ready Theme',
|
||||
'support' => 'Awesome Support',
|
||||
'responsive' => 'Responsive Design',
|
||||
'screenshots' => 'Some Screenshots',
|
||||
'address' => 'Address',
|
||||
'dropus' => 'Drop Us A Line',
|
||||
@@ -136,4 +107,7 @@ return [
|
||||
'loggedin' => 'Logged in!',
|
||||
'entering' => 'Entering...',
|
||||
'registered' => 'User Registered!',
|
||||
'switchoff' => 'Switch Back',
|
||||
'success' => 'Success!',
|
||||
'resetemaillink' => 'We have e-mailed your password reset link!',
|
||||
];
|
||||
|
@@ -1,53 +1,54 @@
|
||||
@extends('adminlte::layouts.auth')
|
||||
|
||||
@section('htmlheader_title')
|
||||
Log in
|
||||
Log in
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<body class="hold-transition login-page">
|
||||
<div id="app" v-cloak>
|
||||
<div class="login-box">
|
||||
<div class="login-logo">
|
||||
<a href="{{ url('/home') }}">{!! config('app.name_html_long') !!}</a>
|
||||
</div><!-- /.login-logo -->
|
||||
<div id="app" v-cloak>
|
||||
<div class="login-box">
|
||||
<div class="login-logo">
|
||||
<a href="{{ url('/home') }}">{!! config('app.name_html_long') !!}</a>
|
||||
</div><!-- /.login-logo -->
|
||||
|
||||
@if (count($errors) > 0)
|
||||
<div class="alert alert-danger">
|
||||
<strong>Whoops!</strong> {{ trans('adminlte_lang::message.someproblems') }}<br><br>
|
||||
<ul>
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
@if (count($errors) > 0)
|
||||
<div class="alert alert-danger">
|
||||
<strong>Whoops!</strong> {{ trans('adminlte_lang::message.someproblems') }}<br><br>
|
||||
<ul>
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="login-box-body">
|
||||
<p class="login-box-msg"> {{ trans('adminlte_lang::message.siginsession') }} </p>
|
||||
<div class="login-box-body">
|
||||
<p class="login-box-msg">{{ trans('adminlte_lang::message.siginsession') }}</p>
|
||||
|
||||
<login-form name="{{ config('auth.providers.users.field','email') }}"
|
||||
domain="{{ config('auth.defaults.domain','') }}"></login-form>
|
||||
<login-form name="{{ config('auth.providers.users.field','email') }}"
|
||||
domain="{{ config('auth.defaults.domain','') }}"></login-form>
|
||||
|
||||
<a href="{{ url('/password/reset') }}">{{ trans('adminlte_lang::message.forgotpassword') }}</a><br>
|
||||
<a href="{{ url('/password/reset') }}">{{ trans('adminlte_lang::message.forgotpassword') }}</a><br>
|
||||
|
||||
@if(count(config('auth.social',[])))
|
||||
@include('adminlte::auth.partials.social_login')
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@if(count(config('auth.social',[])))
|
||||
@include('adminlte::auth.partials.social_login')
|
||||
@endif
|
||||
</div><!-- /.login-box-body -->
|
||||
|
||||
@include('adminlte::layouts.partials.scripts_auth')
|
||||
</div><!-- /.login-box -->
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
$('input').iCheck({
|
||||
checkboxClass: 'icheckbox_square-blue',
|
||||
radioClass: 'iradio_square-blue',
|
||||
increaseArea: '20%' // optional
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@include('adminlte::layouts.partials.scripts_auth')
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
$('input').iCheck({
|
||||
checkboxClass: 'icheckbox_square-blue',
|
||||
radioClass: 'iradio_square-blue',
|
||||
increaseArea: '20%' // optional
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
@endsection
|
@@ -1,59 +1,45 @@
|
||||
@extends('adminlte::layouts.auth')
|
||||
|
||||
@section('htmlheader_title')
|
||||
Password recovery
|
||||
Password recovery
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<body class="hold-transition login-page">
|
||||
<div id="app" v-cloak>
|
||||
<div class="login-box">
|
||||
<div class="login-logo">
|
||||
<a href="{{ url('/home') }}">{!! config('app.name_html_long') !!}</a>
|
||||
</div><!-- /.login-logo -->
|
||||
|
||||
<body class="login-page">
|
||||
<div id="app">
|
||||
@if (session('status'))
|
||||
<div class="alert alert-success">
|
||||
{{ session('status') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="login-box">
|
||||
<div class="login-logo">
|
||||
<a href="{{ url('/home') }}"><b>Admin</b>LTE</a>
|
||||
</div><!-- /.login-logo -->
|
||||
@if (count($errors) > 0)
|
||||
<div class="alert alert-danger">
|
||||
<strong>Whoops!</strong> {{ trans('adminlte_lang::message.someproblems') }}<br><br>
|
||||
<ul>
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if (session('status'))
|
||||
<div class="alert alert-success">
|
||||
{{ session('status') }}
|
||||
</div>
|
||||
@endif
|
||||
<div class="login-box-body">
|
||||
<p class="login-box-msg">{{ trans('adminlte_lang::message.passwordreset') }}</p>
|
||||
|
||||
@if (count($errors) > 0)
|
||||
<div class="alert alert-danger">
|
||||
<strong>Whoops!</strong> {{ trans('adminlte_lang::message.someproblems') }}<br><br>
|
||||
<ul>
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
<email-reset-password-form></email-reset-password-form>
|
||||
|
||||
<div class="login-box-body">
|
||||
<p class="login-box-msg">Reset Password</p>
|
||||
<a href="{{ url('/login') }}">Log in</a><br>
|
||||
</div><!-- /.login-box-body -->
|
||||
|
||||
<email-reset-password-form></email-reset-password-form>
|
||||
</div><!-- /.login-box -->
|
||||
</div>
|
||||
|
||||
<a href="{{ url('/login') }}">Log in</a><br>
|
||||
|
||||
</div><!-- /.login-box-body -->
|
||||
|
||||
</div><!-- /.login-box -->
|
||||
</div>
|
||||
|
||||
@include('adminlte::layouts.partials.scripts_auth')
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
$('input').iCheck({
|
||||
checkboxClass: 'icheckbox_square-blue',
|
||||
radioClass: 'iradio_square-blue',
|
||||
increaseArea: '20%' // optional
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@include('adminlte::layouts.partials.scripts_auth')
|
||||
</body>
|
||||
|
||||
@endsection
|
||||
@endsection
|
@@ -0,0 +1,46 @@
|
||||
@extends('adminlte::layouts.auth')
|
||||
|
||||
@section('htmlheader_title')
|
||||
Password reset
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<body class="hold-transition login-page">
|
||||
<div id="app" v-cloak>
|
||||
<div class="login-box">
|
||||
<div class="login-logo">
|
||||
<a href="{{ url('/home') }}">{!! config('app.name_html_long') !!}</a>
|
||||
</div><!-- /.login-logo -->
|
||||
|
||||
@if (session('status'))
|
||||
<div class="alert alert-success">
|
||||
{{ session('status') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if (count($errors) > 0)
|
||||
<div class="alert alert-danger">
|
||||
<strong>Whoops!</strong> {{ trans('adminlte_lang::message.someproblems') }}<br><br>
|
||||
<ul>
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="login-box-body">
|
||||
<p class="login-box-msg">{{ trans('adminlte_lang::message.passwordreset') }}</p>
|
||||
|
||||
<reset-password-form token="{{ $token }}">></reset-password-form>
|
||||
|
||||
<a href="{{ url('/login') }}">Log in</a><br>
|
||||
<a href="{{ url('/register') }}" class="text-center">{{ trans('adminlte_lang::message.register') }}</a>
|
||||
</div><!-- /.login-box-body -->
|
||||
|
||||
</div><!-- /.login-box -->
|
||||
</div>
|
||||
|
||||
@include('adminlte::layouts.partials.scripts_auth')
|
||||
</body>
|
||||
@endsection
|
@@ -10,7 +10,7 @@
|
||||
<div id="app" v-cloak>
|
||||
<div class="register-box">
|
||||
<div class="register-logo">
|
||||
<a href="{{ url('/home') }}"><b>Pipeline</b>Management</a>
|
||||
<a href="{{ url('/home') }}">{!! config('app.name_html_long') !!}</a>
|
||||
</div>
|
||||
|
||||
@if (count($errors) > 0)
|
||||
|
@@ -5,8 +5,8 @@
|
||||
@include('adminlte::layouts.partials.htmlheader')
|
||||
@show
|
||||
|
||||
<body class="fixed skin-blue sidebar-mini">
|
||||
<div id="app" v-cloak>
|
||||
<body class="fixed hold-transition skin-blue sidebar-mini">
|
||||
<div id="app">
|
||||
<div class="wrapper">
|
||||
@include('adminlte::layouts.partials.mainheader')
|
||||
|
||||
@@ -36,6 +36,9 @@
|
||||
@include('adminlte::layouts.partials.scripts')
|
||||
{{-- Scripts --}}
|
||||
{!! Asset::scripts() !!}
|
||||
|
||||
@yield('page-scripts')
|
||||
@show
|
||||
|
||||
</body>
|
||||
</html>
|
@@ -1,5 +1,5 @@
|
||||
<!-- Main Footer -->
|
||||
<footer class="main-footer">
|
||||
<footer class="main-footer no-print">
|
||||
<!-- To the right -->
|
||||
<div class="pull-right hidden-xs">
|
||||
<a href="#"></a><b>{{ config('app.name') }}</b></a>
|
||||
|
@@ -1,5 +1,6 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>{{ config('app.name') }} - @yield('htmlheader_title', 'Your title here')</title>
|
||||
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
|
||||
<!-- CSRF Token -->
|
||||
@@ -14,6 +15,34 @@
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
<style type="text/css">
|
||||
@media screen, print {
|
||||
body {
|
||||
color: #333;
|
||||
font-weight: 400;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
label {
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
@media print {
|
||||
body {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
tr { page-break-inside:avoid; }
|
||||
thead { display:table-header-group; }
|
||||
tfoot { display:table-footer-group; }
|
||||
|
||||
.table-responsive {
|
||||
overflow: visible !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
//See https://laracasts.com/discuss/channels/vue/use-trans-in-vuejs
|
||||
window.trans =
|
||||
@@ -29,12 +58,6 @@
|
||||
echo json_encode($trans);
|
||||
@endphp
|
||||
</script>
|
||||
<script src="https://code.highcharts.com/highcharts.js"></script>
|
||||
<style>
|
||||
#favourite.selected {
|
||||
color: orange;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- STYLESHEETS -->
|
||||
{!! Asset::styles() !!}
|
||||
|
@@ -45,7 +45,7 @@
|
||||
<!-- Top Menu Items -->
|
||||
@include('adminlte::layouts.partials.topmenu')
|
||||
|
||||
<li class="dropdown user user-menu" id="user_menu">
|
||||
<li class="dropdown user user-menu @if($user->switched) bg-red @endif" id="user_menu">
|
||||
<!-- Menu Toggle Button -->
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<!-- The user image in the navbar-->
|
||||
@@ -69,16 +69,22 @@
|
||||
</div>
|
||||
|
||||
<div class="pull-right">
|
||||
<a href="{{ url('/logout') }}" class="btn btn-default btn-flat" id="logout"
|
||||
onclick="event.preventDefault();
|
||||
document.getElementById('logout-form').submit();">
|
||||
{{ trans('adminlte_lang::message.signout') }}
|
||||
</a>
|
||||
@if ($user->switched)
|
||||
<a href="{{ url('/admin/switch/stop') }}" class="btn btn-default btn-flat" id="switch">
|
||||
{{ trans('adminlte_lang::message.switchoff') }}
|
||||
</a>
|
||||
@else
|
||||
<a href="{{ url('/logout') }}" class="btn btn-default btn-flat" id="logout"
|
||||
onclick="event.preventDefault();
|
||||
document.getElementById('logout-form').submit();">
|
||||
{{ trans('adminlte_lang::message.signout') }}
|
||||
</a>
|
||||
|
||||
<form id="logout-form" action="{{ url('/logout') }}" method="POST" style="display: none;">
|
||||
{{ csrf_field() }}
|
||||
<input type="submit" value="logout" style="display: none;">
|
||||
</form>
|
||||
<form id="logout-form" action="{{ url('/logout') }}" method="POST" style="display: none;">
|
||||
{{ csrf_field() }}
|
||||
<input type="submit" value="logout" style="display: none;">
|
||||
</form>
|
||||
@endif
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -95,4 +101,4 @@
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
</header>
|
@@ -2,12 +2,59 @@
|
||||
|
||||
<!-- 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')
|
||||
}
|
||||
});
|
||||
|
||||
$.AdminLTESidebarTweak = {};
|
||||
|
||||
$.AdminLTESidebarTweak.options = {
|
||||
EnableRemember: true,
|
||||
//Removes the transition after page reload.
|
||||
NoTransitionAfterReload: false
|
||||
};
|
||||
|
||||
$(function () {
|
||||
"use strict";
|
||||
|
||||
$("body").on("collapsed.pushMenu", function(){
|
||||
if($.AdminLTESidebarTweak.options.EnableRemember){
|
||||
document.cookie = "toggleState=closed";
|
||||
}
|
||||
});
|
||||
$("body").on("expanded.pushMenu", function(){
|
||||
if($.AdminLTESidebarTweak.options.EnableRemember){
|
||||
document.cookie = "toggleState=opened";
|
||||
}
|
||||
});
|
||||
|
||||
if($.AdminLTESidebarTweak.options.EnableRemember){
|
||||
var re = new RegExp('toggleState' + "=([^;]+)");
|
||||
var value = re.exec(document.cookie);
|
||||
var toggleState = (value != null) ? unescape(value[1]) : null;
|
||||
if(toggleState == 'closed'){
|
||||
if($.AdminLTESidebarTweak.options.NoTransitionAfterReload){
|
||||
$("body").addClass('sidebar-collapse hold-transition').delay(100).queue(function(){
|
||||
$(this).removeClass('hold-transition');
|
||||
});
|
||||
}else{
|
||||
$("body").addClass('sidebar-collapse');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
</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. -->
|
||||
<script src="{{ url('/plugins/jquery.slimscroll.min.js') }}" type="text/javascript"></script>
|
||||
<script src="{{ url('/plugins/fastclick/fastclick.min.js') }}" type="text/javascript"></script>
|
||||
@js('/site/js/jquery.slimscroll.min.js','jq.slimscroll')
|
||||
@js('/site/js/fastclick.min.js','jq.fastclick')
|
@@ -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() {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<ul class="sidebar-menu" data-widget="tree">
|
||||
<li class="header">Menu</li>
|
||||
<li class="header"><b>MENU</b></li>
|
||||
<!-- Optionally, you can add icons to the links -->
|
||||
<li @if(Route::current()->getName() == 'home')class="active"@endif><a href="{{ url('home',['date'=>(isset($ido) ? $ido->id : NULL)]) }}"><i class='fa fa-link'></i> <span>{{ trans('adminlte_lang::message.home') }}</span></a></li>
|
||||
</ul>
|
||||
|
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);
|
||||
}
|
||||
}
|
57
src/Controllers/AdminController.php
Normal file
57
src/Controllers/AdminController.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace Leenooks\Controllers;
|
||||
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Redirect;
|
||||
use Session;
|
||||
|
||||
use App\User;
|
||||
|
||||
class AdminController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
public function switch_authorised($id)
|
||||
{
|
||||
return (method_exists(Auth::user(),'isAdmin') && Auth::user()->isAdmin($id)) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
public function switch_session()
|
||||
{
|
||||
return ! Session::get('orig_user');
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Change the background color (or something) so we know we are switched
|
||||
*/
|
||||
public function user_switch_start($id)
|
||||
{
|
||||
if ($this->switch_session() AND $this->switch_authorised($id))
|
||||
{
|
||||
$uo = User::find($id);
|
||||
|
||||
if (! $uo)
|
||||
abort(404,'User not found');
|
||||
|
||||
Session::put('orig_user',Auth::id());
|
||||
Auth::login($uo);
|
||||
}
|
||||
|
||||
return Redirect::to('/home');
|
||||
}
|
||||
|
||||
public function user_switch_stop()
|
||||
{
|
||||
if ($id = Session::pull('orig_user')) {
|
||||
$uo = User::find($id);
|
||||
Auth::login($uo);
|
||||
}
|
||||
|
||||
return Redirect::to('/home');
|
||||
}
|
||||
}
|
57
src/Traits/CompositeKeys.php
Normal file
57
src/Traits/CompositeKeys.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace Leenooks\Traits;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
/**
|
||||
* Trait CompositeKeys
|
||||
* Enable Models to have multiple primary keys
|
||||
*
|
||||
* Need to add to the Model...
|
||||
* public $incrementing = false;
|
||||
* protected $primaryKey = [<ARRAY_OF_KEYS>];
|
||||
*
|
||||
* @package Leenooks\Traits
|
||||
*/
|
||||
trait CompositeKeys {
|
||||
/**
|
||||
* Set the keys for a save update query.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
protected function setKeysForSaveQuery(Builder $query)
|
||||
{
|
||||
$keys = $this->getKeyName();
|
||||
|
||||
if (! is_array($keys)) {
|
||||
return parent::setKeysForSaveQuery($query);
|
||||
}
|
||||
|
||||
foreach($keys as $keyName) {
|
||||
$query->where($keyName, '=', $this->getKeyForSaveQuery($keyName));
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the primary key value for a save query.
|
||||
*
|
||||
* @param mixed $keyName
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getKeyForSaveQuery($keyName = null)
|
||||
{
|
||||
if (is_null($keyName)) {
|
||||
$keyName = $this->getKeyName();
|
||||
}
|
||||
|
||||
if (isset($this->original[$keyName])) {
|
||||
return $this->original[$keyName];
|
||||
}
|
||||
|
||||
return $this->getAttribute($keyName);
|
||||
}
|
||||
}
|
21
src/Traits/UserSwitch.php
Normal file
21
src/Traits/UserSwitch.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Check if users have been switched
|
||||
*/
|
||||
namespace Leenooks\Traits;
|
||||
|
||||
use Session;
|
||||
|
||||
trait UserSwitch
|
||||
{
|
||||
public function getSwitchedAttribute()
|
||||
{
|
||||
return Session::get('orig_user');
|
||||
}
|
||||
|
||||
public function isAdmin($id)
|
||||
{
|
||||
return isset($this->admin) ? $this->admin : FALSE;
|
||||
}
|
||||
}
|
29
src/helpers.php
Normal file
29
src/helpers.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
|
||||
// Inverse of array_dot()
|
||||
if (! function_exists('array_undot')) {
|
||||
function array_undot($dotNotationArray)
|
||||
{
|
||||
$array = [];
|
||||
|
||||
foreach ($dotNotationArray as $key => $value) {
|
||||
array_set($array, $key, $value);
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user