Compare commits

..

6 Commits

Author SHA1 Message Date
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
7 changed files with 126 additions and 56 deletions

View File

@@ -10,11 +10,16 @@
} }
], ],
"require": { "require": {
"igaster/laravel-theme": "^2.0.12", "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"
}, },
"repositories": [
{
"type": "vcs",
"url": "https://github.com/leenooks/laravel-theme"
}
],
"require-dev": { "require-dev": {
}, },
"autoload": { "autoload": {

View File

@@ -29,11 +29,11 @@ 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',
'signMeetup' => 'Sign in using Meetup', 'signMeetup' => 'Sign in using Meetup',
'sendpassword' => 'Send Password Reset Link', 'sendpassword' => 'Send Password Reset Link',
'passwordreset' => 'Reset password', 'passwordreset' => 'Reset password',
'pagenotfound' => 'Page not found', 'pagenotfound' => 'Page not found',

View File

@@ -21,6 +21,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">

View File

@@ -15,6 +15,7 @@
</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->name ?: 'Nobody' }}</a>
@isset($user->lastlogin)<a 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>

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;
@@ -12,60 +13,58 @@ use Illuminate\Support\ServiceProvider;
*/ */
class LeenooksServiceProvider extends ServiceProvider class LeenooksServiceProvider extends ServiceProvider
{ {
private $_path = ''; private $_path = '';
/** /**
* Bootstrap the application services. * Bootstrap the application services.
* *
* @param Router $router * @param Router $router
*/ */
public function boot(Router $router) public function boot(Router $router)
{ {
$this->loadViewsFrom($this->_path.'/resources/themes/adminlte/views/', 'adminlte'); $router->pushMiddlewareToGroup('web',GuestUser::class);
$this->loadTranslationsFrom($this->_path.'/resources/themes/adminlte/lang/', 'adminlte_lang');
// Enable a recusive() collection function so that we can just arrives in config/*.php $this->loadViewsFrom($this->_path.'/resources/themes/adminlte/views/', 'adminlte');
\Illuminate\Support\Collection::macro('recursive', function () { $this->loadTranslationsFrom($this->_path.'/resources/themes/adminlte/lang/', 'adminlte_lang');
return $this->map(function ($value) {
if (is_array($value) || is_object($value)) {
return collect($value)->recursive();
}
return $value; // Enable a Collect::recursive() function
\Illuminate\Support\Collection::macro('recursive', function () {
return $this->map(function ($value) {
if (is_array($value) || is_object($value)) {
return collect($value)->recursive();
}
return $value;
});
}); });
}); }
}
/** /**
* Register the application services. * Register the application services.
* *
* @return void * @return void
*/ */
public function register() public function register()
{ {
if (! $this->_path) { if (! $this->_path) {
$this->_path = realpath(__DIR__.'/../../'); $this->_path = realpath(__DIR__.'/../../');
} }
} }
/** /**
* Views copy path. * Views copy path.
* *
* @return array * @return array
*/ */
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'),
];
}
}