Compare commits

...

20 Commits

Author SHA1 Message Date
Deon George
96a6830e61 Changed carbon method naming to be consistent with Carbon itself 2020-02-08 17:52:13 +11:00
Deon George
176f680ff7 Enabled password reset forms 2020-01-22 20:48:42 +11:00
Deon George
62f66d7eed Fixes for laravel 6 2020-01-14 21:43:40 +11:00
Deon George
f131db31c6 Added custom.js, login redirects to current page, added form-start/form-end and change breadcrumb width 2020-01-09 18:44:07 +11:00
Deon George
8b83990a66 Changed not logged in user to padlock with 'Login' 2019-12-16 11:29:34 +11:00
Deon George
4472202afb Display improvements for login note 2019-11-29 11:13:24 +11:00
Deon George
2040266ab2 Disable autocomplete in search 2019-11-26 09:58:45 +11:00
Deon George
1774987dea Dispatch resize event if sidebar collapsed 2019-11-22 14:22:37 +11:00
Deon George
6c60298e8f Add a note on the login page 2019-11-21 14:33:33 +11:00
Deon George
41b320a5b9 Fix file_exist check for custom.css 2019-11-17 23:26:12 +11:00
Deon George
1096f0e28d Added custom.css to app.blade 2019-10-30 14:31:32 +08:00
Deon George
b0730b9ed3 Revert name to igaster/laravel-theme 2019-10-30 14:15:20 +08:00
Deon George
163a7f2587 Add github cvs to composer 2019-10-30 12:15:23 +08:00
Deon George
4f2707a374 Switch laravel-them to fix issue with @ directives 2019-10-30 09:49:19 +08:00
Deon George
0ca66c6d1c Updated orchestra/asset 2019-10-11 15:50:06 +11:00
Deon George
5833122ab5 Removed Acache/User 2019-10-11 14:47:13 +11:00
Deon George
a946ce4418 Added error dialog on login box 2019-09-03 14:38:19 +10:00
Deon George
e5ff189d3e Added tz and move adminlte css to later 2019-08-20 15:50:15 +10:00
Deon George
1efdfca55f Remove mix() for now 2019-07-03 17:16:46 +10:00
Deon George
6d876f2c94 No longer using // urls, and fixed sudo rendoring 2019-06-17 11:44:56 +10:00
18 changed files with 314 additions and 172 deletions

View File

@@ -10,10 +10,9 @@
} }
], ],
"require": { "require": {
"igaster/laravel-theme": "^2.0", "igaster/laravel-theme": "^2.0.15",
"acacha/user": "^0.2.2",
"creativeorange/gravatar": "^1.0", "creativeorange/gravatar": "^1.0",
"orchestra/asset": "^3.6" "orchestra/asset": "^4.0"
}, },
"require-dev": { "require-dev": {
}, },

View File

@@ -29,7 +29,7 @@ return [
'signGithub' => 'Sign in using Github', 'signGithub' => 'Sign in using Github',
'signFacebook' => 'Sign in using Facebook', 'signFacebook' => 'Sign in using Facebook',
'signTwitter' => 'Sign in using Twitter', 'signTwitter' => 'Sign in using Twitter',
'signGoogle+' => 'Sign in using Google+', 'signGoogle' => 'Sign in using Google',
'signLinkedin' => 'Sign in using Linkedin', 'signLinkedin' => 'Sign in using Linkedin',
'signW3id' => 'Sign in using W3id', 'signW3id' => 'Sign in using W3id',
'signIBMid' => 'Sign in using IBMid', 'signIBMid' => 'Sign in using IBMid',

View File

@@ -5,7 +5,16 @@
@endsection @endsection
@section('content') @section('content')
<div class="login-box"> @if(isset($login_note) AND $login_note)
<div class="alert alert-info alert-dismissible m-auto">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<h5><i class="icon fa fa-info"></i> NOTE!</h5>
{!! $login_note !!}
</div>
<br>
@endisset
<div class="login-box m-auto">
<div class="login-logo"> <div class="login-logo">
<a>{!! config('app.name_html_long') !!}</a> <a>{!! config('app.name_html_long') !!}</a>
</div> </div>
@@ -21,6 +30,15 @@
</div> </div>
@endif @endif
@if (Session::has('error'))
<div class="alert alert-danger">
<strong>Whoops!</strong> {{ trans('adminlte_lang::message.someproblems') }}<br><br>
<ul>
<li>{{ Session::get('error') }}</li>
</ul>
</div>
@endif
<!-- /.login-logo --> <!-- /.login-logo -->
<div class="card"> <div class="card">
<div class="card-body login-card-body"> <div class="card-body login-card-body">
@@ -61,12 +79,12 @@
@endif @endif
<p class="mb-1"> <p class="mb-1">
<a name="reset" href="{{ url('/password/reset') }}">{{ trans('adminlte_lang::message.forgotpassword') }}</a> <a name="reset" href="{{ url('password/reset') }}">{{ trans('adminlte_lang::message.forgotpassword') }}</a>
</p> </p>
@isset($register) @isset($register)
<p class="mb-0"> <p class="mb-0">
<a href="register.html" class="text-center">Register a new membership</a> <a href="{{ url('register') }}" class="text-center">{{ trans('adminlte_lang::message.register') }}</a>
</p> </p>
@endisset @endisset
</div> </div>

View File

@@ -1,7 +1,7 @@
<!-- Compiled app javascript --> <!-- Compiled app javascript -->
<script src="{{ url (mix('/js/app.js')) }}"></script> <script src="{{ asset('/js/app.js') }}"></script>
<!-- iCheck --> <!-- iCheck -->
<script src="/plugin/iCheck/icheck.min.js"></script> <script src="{{ asset('/plugin/iCheck/icheck.min.js') }}"></script>
<script> <script>
$(document).ready(function() { $(document).ready(function() {

View File

@@ -5,16 +5,16 @@
@endsection @endsection
@section('content') @section('content')
<body class="hold-transition login-page"> <div class="login-box m-auto">
<div id="app" v-cloak>
<div class="login-box">
<div class="login-logo"> <div class="login-logo">
<a href="{{ url('/home') }}">{!! config('app.name_html_long') !!}</a> <a>{!! config('app.name_html_long') !!}</a>
</div><!-- /.login-logo --> </div>
@if (session('status')) @if (Session::has('status'))
<div class="alert alert-success"> <div class="text-center mb-3">
{{ session('status') }} <div class="alert alert-success m-auto">
<strong>OK!</strong> {{ Session::get('status') }}
</div>
</div> </div>
@endif @endif
@@ -29,17 +29,39 @@
</div> </div>
@endif @endif
<div class="login-box-body"> <!-- /.login-logo -->
<p class="login-box-msg">{{ trans('adminlte_lang::message.passwordreset') }}</p> <div class="card">
<div class="card-body login-card-body">
<p class="login-box-msg">You forgot your password? Here you can easily retrieve a new password.</p>
<email-reset-password-form></email-reset-password-form> <form method="post" action="{{ url('password/email') }}">
{{ csrf_field() }}
<a href="{{ url('/login') }}">Log in</a><br> <div class="input-group mb-3">
</div><!-- /.login-box-body --> <input type="email" name="email" class="form-control" placeholder="Email" required>
<div class="input-group-append">
</div><!-- /.login-box --> <span class="fa fa-envelope input-group-text"></span>
</div> </div>
</div>
<div class="row">
<div class="col-12">
<button type="submit" class="btn btn-primary btn-block">{{ trans('adminlte_lang::message.sendpassword') }}</button>
</div>
<!-- /.col -->
</div>
</form>
@include('adminlte::layouts.partials.scripts_auth') <p class="mt-3 mb-1">
</body> <a href="{{ url('login') }}">{{ trans('adminlte_lang::message.login') }}</a>
</p>
@isset($register)
<p class="mb-0">
<a href="{{ url('register') }}" class="text-center">{{ trans('adminlte_lang::message.register') }}</a>
</p>
@endisset
</div>
<!-- /.login-card-body -->
</div>
</div>
<!-- /.login-box -->
@endsection @endsection

View File

@@ -5,18 +5,10 @@
@endsection @endsection
@section('content') @section('content')
<body class="hold-transition login-page"> <div class="login-box m-auto">
<div id="app" v-cloak>
<div class="login-box">
<div class="login-logo"> <div class="login-logo">
<a href="{{ url('/home') }}">{!! config('app.name_html_long') !!}</a> <a>{!! config('app.name_html_long') !!}</a>
</div><!-- /.login-logo -->
@if (session('status'))
<div class="alert alert-success">
{{ session('status') }}
</div> </div>
@endif
@if (count($errors) > 0) @if (count($errors) > 0)
<div class="alert alert-danger"> <div class="alert alert-danger">
@@ -29,18 +21,49 @@
</div> </div>
@endif @endif
<div class="login-box-body"> <!-- /.login-logo -->
<p class="login-box-msg">{{ trans('adminlte_lang::message.passwordreset') }}</p> <div class="card">
<div class="card-body login-card-body">
<p class="login-box-msg">You are only one step a way from your new password, set your new password now.</p>
<reset-password-form token="{{ $token }}">></reset-password-form> <form method="post" action="{{ url('password/reset') }}">
{{ csrf_field() }}
<a href="{{ url('/login') }}">Log in</a><br> <div class="input-group mb-3">
<a href="{{ url('/register') }}" class="text-center">{{ trans('adminlte_lang::message.register') }}</a> <input type="email" name="email" class="form-control" placeholder="Email" required>
</div><!-- /.login-box-body --> <div class="input-group-append">
<span class="fa fa-envelope input-group-text"></span>
</div><!-- /.login-box -->
</div> </div>
</div>
<div class="input-group mb-3">
<input type="password" name="password" class="form-control" placeholder="Password" required>
<div class="input-group-append">
<span class="fa fa-lock input-group-text"></span>
</div>
</div>
<div class="input-group mb-3">
<input type="password" name="password_confirmation" class="form-control" placeholder="Confirm Password" data-match="#password" required>
<div class="input-group-append">
<span class="fa fa-lock input-group-text"></span>
</div>
</div>
<div class="row">
<div class="col-12">
<button type="submit" class="btn btn-primary btn-block">{{ trans('adminlte_lang::message.passwordreset') }}</button>
</div>
<!-- /.col -->
</div>
<input type="hidden" name="token" value="{{ $token }}">
</form>
@include('adminlte::layouts.partials.scripts_auth') <p class="mt-3 mb-1">
</body> <a href="{{ url('login') }}">Login</a>
@isset($register)
<a href="{{ url('register') }}" class="text-center">{{ trans('adminlte_lang::message.register') }}</a>
@endisset
</p>
</div>
<!-- /.login-card-body -->
</div>
</div>
<!-- /.login-box -->
@endsection @endsection

View File

@@ -13,7 +13,8 @@
<!-- Content Wrapper. Contains page content --> <!-- Content Wrapper. Contains page content -->
<div class="content-wrapper"> <div class="content-wrapper">
<!-- In case we have input fields in the header -->
@yield('page-form-start')
@include('adminlte::layouts.partials.contentheader') @include('adminlte::layouts.partials.contentheader')
<!-- Main content --> <!-- Main content -->
@@ -24,6 +25,7 @@
</div> </div>
</section><!-- /.content --> </section><!-- /.content -->
@yield('page-form-end')
</div><!-- /.content-wrapper --> </div><!-- /.content-wrapper -->
@isset($controlsidebar) @isset($controlsidebar)

View File

@@ -4,7 +4,7 @@
@include('adminlte::layouts.partials.htmlheader') @include('adminlte::layouts.partials.htmlheader')
<!-- iCheck --> <!-- iCheck -->
<link rel="stylesheet" href="/plugin/iCheck/square/blue.css"> <link rel="stylesheet" href="{{ asset('/plugin/iCheck/square/blue.css') }}">
@show @show
<body class="hold-transition login-page"> <body class="hold-transition login-page">

View File

@@ -1,12 +1,13 @@
<!-- Content Header (Page header) --> <!-- Content Header (Page header) -->
<div class="content-header"> <div class="content-header d-print-none">
<div class="container-fluid"> <div class="container-fluid">
<div class="row mb-2"> <div class="row mb-2">
<div class="col-sm-6"> <div class="col-sm-8">
<h1 class="m-0 text-dark">@yield('contentheader_title', 'Content Title')</h1> <h1 class="m-0 text-dark">@yield('contentheader_title', 'Content Title')</h1>
<small>@yield('contentheader_description','Description')</small> <small>@yield('contentheader_description','Description')</small>
</div><!-- /.col --> </div><!-- /.col -->
<div class="col-sm-6">
<div class="col-sm-4">
<ol class="breadcrumb float-sm-right small"> <ol class="breadcrumb float-sm-right small">
<li class="breadcrumb-item"><a href="{{ url('/home'.(isset($ido) ? '/'.$ido->id : '')) }}">Home</a></li> <li class="breadcrumb-item"><a href="{{ url('/home'.(isset($ido) ? '/'.$ido->id : '')) }}">Home</a></li>
@isset($breadcrumb) @isset($breadcrumb)

View File

@@ -6,23 +6,23 @@
<!-- CSRF Token --> <!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}"> <meta name="csrf-token" content="{{ csrf_token() }}">
<link href="{{ asset('/css/app.css') }}" rel="stylesheet" type="text/css" /> <link rel="stylesheet" href="{{ asset('/css/app.css') }}">
<!-- Font Awesome Icons --> <!-- Font Awesome Icons -->
<link rel="stylesheet" href="/plugin/font-awesome/css/font-awesome.min.css"> <link rel="stylesheet" href="{{ asset('/plugin/font-awesome/css/font-awesome.min.css') }}">
<!-- IonIcons --> <!-- IonIcons -->
<link rel="stylesheet" href="//code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css"> <link rel="stylesheet" href="{{ request()->getScheme() }}://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="/css/adminlte.min.css">
<!-- Google Font: Source Sans Pro --> <!-- Google Font: Source Sans Pro -->
<link href="//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet"> <link href="{{ request()->getScheme() }}://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
@if(file_exists('css/social.css')) @if(file_exists('css/social.css'))
<!-- Social Logins --> <!-- Social Logins -->
<link rel="stylesheet" href="/css/social.css"> <link rel="stylesheet" href="{{ asset('/css/social.css') }}">
@endif @endif
@if(file_exists('css/print.css')) @if(file_exists('css/print.css'))
<!-- Printing Modifications --> <!-- Printing Modifications -->
<link rel="stylesheet" href="/css/print.css"> <link rel="stylesheet" href="{{ asset('/css/print.css') }}">
@endif @endif
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
@@ -32,28 +32,19 @@
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]--> <![endif]-->
<script>
//See https://laracasts.com/discuss/channels/vue/use-trans-in-vuejs
window.trans =
@php
// @todo Cache this processing
// copy all translations from /resources/lang/CURRENT_LOCALE/* to global JS variable
$lang_files = File::files(resource_path() . '/lang/' . App::getLocale());
$trans = [];
foreach ($lang_files as $f) {
$filename = pathinfo($f)['filename'];
$trans[$filename] = trans($filename);
}
$trans['adminlte_lang_message'] = trans('adminlte_lang::message');
echo json_encode($trans);
@endphp
</script>
<!-- STYLESHEETS --> <!-- STYLESHEETS -->
{!! Asset::styles() !!} {!! Asset::styles() !!}
<!-- Theme style -->
<link rel="stylesheet" href="{{ asset('/css/adminlte.min.css') }}">
@if(file_exists('css/fixes.css')) @if(file_exists('css/fixes.css'))
<!-- CSS Fixes --> <!-- CSS Fixes -->
<link rel="stylesheet" href="/css/fixes.css"> <link rel="stylesheet" href="{{ asset('/css/fixes.css') }}">
@endif
@if(file_exists('css/custom.css'))
<!-- Custom CSS -->
<link rel="stylesheet" href="{{ asset('/css/custom.css') }}">
@endif @endif
</head> </head>

View File

@@ -11,7 +11,7 @@
<!-- SEARCH FORM --> <!-- SEARCH FORM -->
<form class="form-inline ml-3"> <form class="form-inline ml-3">
<div class="input-group input-group-sm"> <div class="input-group input-group-sm">
<input class="form-control form-control-navbar" name="q" type="search" placeholder="Search" aria-label="Search"> <input class="form-control form-control-navbar" name="q" type="search" placeholder="Search" aria-label="Search" autocomplete="off">
<div class="input-group-append"> <div class="input-group-append">
<button class="btn btn-navbar" type="submit"> <button class="btn btn-navbar" type="submit">
<i class="fa fa-search"></i> <i class="fa fa-search"></i>
@@ -33,7 +33,13 @@
<i class="fa fa-cog"></i> <i class="fa fa-cog"></i>
</a> </a>
<div class="dropdown-menu dropdown-menu-lg dropdown-menu-right"> <div class="dropdown-menu dropdown-menu-lg dropdown-menu-right">
<span class="dropdown-item dropdown-header">{{ $user->name ?: 'User Name' }}</span> <span class="dropdown-item dropdown-header @if($user->switched) bg-danger @endif">
@if($user->switched)
SUDO (<small>{{ $user->name ?: 'User Name' }}</small>)
@else
{{ $user->name ?: 'User Name' }}
@endif
</span>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a href="{{ url('settings') }}" class="dropdown-item"> <a href="{{ url('settings') }}" class="dropdown-item">
@@ -41,13 +47,19 @@
</a> </a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
@if ($user->switched)
<a href="{{ url('/admin/switch/stop') }}" class="dropdown-item" id="switch">
<i class="fa fa-sign-out mr-2"></i> {{ trans('adminlte_lang::message.switchoff') }}
</a>
@else
<a href="{{ url('logout') }}" class="dropdown-item"> <a href="{{ url('logout') }}" class="dropdown-item">
<i class="fa fa-sign-out mr-2"></i> Log Out <i class="fa fa-sign-out mr-2"></i> Log Out
</a> </a>
@endif
</div> </div>
</li> </li>
@else @else
<a href="{{ url('login') }}" class="text-muted pr-2"><i class="fa fa-lock"></i></a> <a href="{{ url()->current().'?login=1' }}" class="text-muted pr-2"><i class="fa fa-lock"></i></a>
@endif @endif
<!-- Control Side Bar --> <!-- Control Side Bar -->

View File

@@ -1,9 +1,9 @@
<!-- REQUIRED JS SCRIPTS --> <!-- REQUIRED JS SCRIPTS -->
<!-- JQuery and bootstrap are required by Laravel 5.7 in resources/js/bootstrap.js--> <!-- JQuery and bootstrap are required by Laravel 5.7 in resources/js/bootstrap.js-->
<!-- Laravel App --> <!-- Laravel App -->
<script src="{{ url(mix('/js/app.js')) }}" type="text/javascript"></script> <script src="{{ asset('/js/app.js') }}" type="text/javascript"></script>
<!-- AdminLTE --> <!-- AdminLTE -->
<script src="/js/adminlte.min.js"></script> <script src="{{ asset('/js/adminlte.min.js') }}"></script>
<script type="text/javascript"> <script type="text/javascript">
// Our CSRF token to each interaction // Our CSRF token to each interaction
@@ -21,6 +21,9 @@
NoTransitionAfterReload: false NoTransitionAfterReload: false
}; };
// Work out our timezone.
const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
$(function () { $(function () {
"use strict"; "use strict";
@@ -57,9 +60,19 @@
$(this).removeClass('hold-transition'); $(this).removeClass('hold-transition');
}); });
}else{ }else{
$("body").addClass('sidebar-collapse'); $("body")
.addClass('sidebar-collapse')
.delay(500).queue(function () {
window.dispatchEvent(new Event('resize'));
$(this).dequeue();
});
} }
} }
} }
}); });
</script> </script>
@if(file_exists('js/custom.js'))
<!-- Any Custom JS -->
<script src="{{ asset('js/custom.js') }}"></script>
@endif

View File

@@ -1,8 +1,8 @@
<!-- Main Sidebar Container --> <!-- Main Sidebar Container -->
<aside class="main-sidebar sidebar-dark-primary elevation-4"> <aside class="main-sidebar sidebar-dark-primary elevation-4 d-print-none">
<!-- Brand Logo --> <!-- Brand Logo -->
<a href="{{ url('home') }}" class="brand-link"> <a href="{{ url('home') }}" class="brand-link">
<img src="/img/logo.png" alt="Logo" class="brand-image img-circle elevation-3" style="opacity: .8"> <img src="{{ asset('/img/logo.png') }}" alt="Logo" class="brand-image img-circle elevation-3" style="opacity: .8">
<span class="brand-text font-weight-light">{!! config('app.name_html_long','<b>App</b>Name') !!}</span> <span class="brand-text font-weight-light">{!! config('app.name_html_long','<b>App</b>Name') !!}</span>
</a> </a>
@@ -11,10 +11,16 @@
<!-- Sidebar user panel (optional) --> <!-- Sidebar user panel (optional) -->
<div class="user-panel mt-3 pb-3 mb-3 d-flex"> <div class="user-panel mt-3 pb-3 mb-3 d-flex">
<div class="image"> <div class="image">
@if($user->exists)
<img src="{{ Gravatar::get(($user->exists AND $user->email) ? $user->email : 'nobody@example.com') }}" class="img-circle elevation-2" alt="User"> <img src="{{ Gravatar::get(($user->exists AND $user->email) ? $user->email : 'nobody@example.com') }}" class="img-circle elevation-2" alt="User">
@else
<a name="login" href="{{ url()->current().'?login=1' }}" class="d-block"><i class="pl-1 fa fa-3x fa-lock"></i></a>
@endif
</div> </div>
<div class="info"> <div class="info">
<a href="{{ url('login') }}" class="d-block">{{ $user->name ?: 'Nobody' }}</a> <a href="{{ url('login') }}" class="d-block">{{ $user->exists ? ($user->name ?: 'No Name') : 'Login' }}</a>
@isset($user->lastlogin)<a name="login" span="d-block"><small><span style="color: #747474;">Last On:</span> {{ $user->lastlogin->format('Y-m-d H:i') }}</small></a>@endisset
</div> </div>
</div> </div>

View File

@@ -34,7 +34,7 @@ class Carbon extends CarbonBase
* *
* @return static * @return static
*/ */
public function firstOfHalf($dayOfWeek = null) public function startOfHalf($dayOfWeek = null)
{ {
return $this->setDate($this->year, $this->half * static::MONTHS_PER_HALF - 5, 1)->firstOfMonth($dayOfWeek); return $this->setDate($this->year, $this->half * static::MONTHS_PER_HALF - 5, 1)->firstOfMonth($dayOfWeek);
} }
@@ -49,7 +49,7 @@ class Carbon extends CarbonBase
* *
* @return static * @return static
*/ */
public function lastOfHalf($dayOfWeek = null) public function endOfHalf($dayOfWeek = null)
{ {
return $this->setDate($this->year, $this->half * static::MONTHS_PER_HALF, 1)->lastOfMonth($dayOfWeek); return $this->setDate($this->year, $this->half * static::MONTHS_PER_HALF, 1)->lastOfMonth($dayOfWeek);
} }

29
src/GuestUser.php Normal file
View File

@@ -0,0 +1,29 @@
<?php
namespace Leenooks;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class GuestUser extends Authenticatable
{
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
}

View File

@@ -0,0 +1,27 @@
<?php
namespace Leenooks\Http\Middleware;
use Closure;
/**
* Class GuestUser
* @package Leenooks\Laravel\Http\Middleware
*/
class GuestUser
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
view()->share('loggedin',auth()->check());
view()->share('user', auth()->user() ?: new \Leenooks\GuestUser);
return $next($request);
}
}

View File

@@ -2,6 +2,7 @@
namespace Leenooks\Providers; namespace Leenooks\Providers;
use Leenooks\Http\Middleware\GuestUser;
use Illuminate\Routing\Router; use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
@@ -21,12 +22,15 @@ class LeenooksServiceProvider extends ServiceProvider
*/ */
public function boot(Router $router) public function boot(Router $router)
{ {
$router->pushMiddlewareToGroup('web',GuestUser::class);
$this->loadViewsFrom($this->_path.'/resources/themes/adminlte/views/', 'adminlte'); $this->loadViewsFrom($this->_path.'/resources/themes/adminlte/views/', 'adminlte');
$this->loadTranslationsFrom($this->_path.'/resources/themes/adminlte/lang/', 'adminlte_lang'); $this->loadTranslationsFrom($this->_path.'/resources/themes/adminlte/lang/', 'adminlte_lang');
// Enable a recusive() collection function so that we can just arrives in config/*.php // Enable a Collect::recursive() function
\Illuminate\Support\Collection::macro('recursive', function () { \Illuminate\Support\Collection::macro('recursive', function () {
return $this->map(function ($value) { return $this->map(function ($value) {
if (is_array($value) || is_object($value)) { if (is_array($value) || is_object($value)) {
return collect($value)->recursive(); return collect($value)->recursive();
} }
@@ -56,16 +60,11 @@ class LeenooksServiceProvider extends ServiceProvider
public function views() public function views()
{ {
return [ return [
$this->_path.'/resources/views/auth' => $this->_path.'/resources/views/auth' => resource_path('views/vendor/adminlte/auth'),
resource_path('views/vendor/adminlte/auth'), $this->_path.'/resources/views/errors' => resource_path('views/vendor/adminlte/errors'),
$this->_path.'/resources/views/errors' => $this->_path.'/resources/views/layouts' => resource_path('views/vendor/adminlte/layouts'),
resource_path('views/vendor/adminlte/errors'), $this->_path.'/resources/views/home.blade.php' => resource_path('views/vendor/adminlte/home.blade.php'),
$this->_path.'/resources/views/layouts' => $this->_path.'/resources/views/welcome.blade.php' => resource_path('views/welcome.blade.php'),
resource_path('views/vendor/adminlte/layouts'),
$this->_path.'/resources/views/home.blade.php' =>
resource_path('views/vendor/adminlte/home.blade.php'),
$this->_path.'/resources/views/welcome.blade.php' =>
resource_path('views/welcome.blade.php'),
]; ];
} }
} }

View File

@@ -21,7 +21,7 @@ if (! function_exists('array_undot')) {
$array = []; $array = [];
foreach ($dotNotationArray as $key => $value) { foreach ($dotNotationArray as $key => $value) {
array_set($array, $key, $value); \Illuminate\Support\Arr::set($array, $key, $value);
} }
return $array; return $array;