From e50990020113926d56b89db682bfc5d61925ec54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manel=20Gavald=C3=A0?= Date: Wed, 15 Jul 2020 19:57:08 +0200 Subject: [PATCH 1/9] Removing dependencies --- composer.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 96037ae6..4a23becc 100644 --- a/composer.json +++ b/composer.json @@ -14,11 +14,8 @@ ], "require": { "php": "^7.1.3", - "acacha/filesystem": "^0.1.2", - "acacha/helpers": "^0.1.4", - "acacha/user": "~0.2", "creativeorange/gravatar": "~1.0", - "laravel/framework": "^5.4", + "laravel/framework": "6.*", "league/flysystem": "^1.0" }, "require-dev": { From 42f5eee5aae70d670e4bba509495804533f942bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manel=20Gavald=C3=A0?= Date: Thu, 16 Jul 2020 11:59:45 +0200 Subject: [PATCH 2/9] Remove acacha/user reference --- src/Providers/AdminLTETemplateServiceProvider.php | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/Providers/AdminLTETemplateServiceProvider.php b/src/Providers/AdminLTETemplateServiceProvider.php index eb710bae..4552be40 100644 --- a/src/Providers/AdminLTETemplateServiceProvider.php +++ b/src/Providers/AdminLTETemplateServiceProvider.php @@ -3,7 +3,6 @@ namespace Acacha\AdminLTETemplateLaravel\Providers; use Acacha\AdminLTETemplateLaravel\Facades\AdminLTE; -use Acacha\User\Providers\GuestUserServiceProvider; use Creativeorange\Gravatar\Facades\Gravatar; use Creativeorange\Gravatar\GravatarServiceProvider; use Illuminate\Console\DetectsApplicationNamespace; @@ -52,23 +51,12 @@ public function register() $this->registerGravatarServiceProvider(); } - if (config('adminlte.guestuser', true)) { - $this->registerGuestUserProvider(); - } if (config('auth.providers.users.field', 'email') === 'username' && config('adminlte.add_nullable_username', true)) { $this->loadMigrationsFrom(ADMINLTETEMPLATE_PATH .'/database/migrations/username_login'); } } - /** - * Register Guest User Provider. - */ - protected function registerGuestUserProvider() - { - $this->app->register(GuestUserServiceProvider::class); - } - /** * Register Gravatar Service Provider. */ From 833dc2f74f57da588e20855f5bc251e8e3547424 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manel=20Gavald=C3=A0?= Date: Thu, 16 Jul 2020 12:08:39 +0200 Subject: [PATCH 3/9] Add filesystem dependency --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index 4a23becc..fedfa7f6 100644 --- a/composer.json +++ b/composer.json @@ -16,6 +16,7 @@ "php": "^7.1.3", "creativeorange/gravatar": "~1.0", "laravel/framework": "6.*", + "acacha/filesystem": "^0.1.2", "league/flysystem": "^1.0" }, "require-dev": { From c6e5eaf464996e3d159ae1c36dc477d75513f6c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manel=20Gavald=C3=A0?= Date: Thu, 16 Jul 2020 12:25:53 +0200 Subject: [PATCH 4/9] Add acacha helpers --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index fedfa7f6..10b34c6c 100644 --- a/composer.json +++ b/composer.json @@ -17,6 +17,7 @@ "creativeorange/gravatar": "~1.0", "laravel/framework": "6.*", "acacha/filesystem": "^0.1.2", + "acacha/helpers": "^0.1.4", "league/flysystem": "^1.0" }, "require-dev": { From 912a708aef0ef82881ea6902d6ab744ae750e508 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manel=20Gavald=C3=A0?= Date: Fri, 17 Jul 2020 17:59:03 +0200 Subject: [PATCH 5/9] Remove dusk registration --- src/stubs/AppServiceProvider.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/stubs/AppServiceProvider.php b/src/stubs/AppServiceProvider.php index 32887e81..a3514827 100644 --- a/src/stubs/AppServiceProvider.php +++ b/src/stubs/AppServiceProvider.php @@ -24,8 +24,6 @@ public function boot() */ public function register() { - if ($this->app->environment('local', 'testing')) { - $this->app->register(DuskServiceProvider::class); - } + // } } From 8a89c1f5b43021e41e2d7f2a0266e3a6d6cb67bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manel=20Gavald=C3=A0?= Date: Fri, 17 Jul 2020 20:10:25 +0200 Subject: [PATCH 6/9] UserGuest package implementation --- src/GuestUser.php | 40 +++++++++++++++++++ src/Http/Middleware/GuestUser.php | 27 +++++++++++++ .../AdminLTETemplateServiceProvider.php | 14 +++++-- 3 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 src/GuestUser.php create mode 100644 src/Http/Middleware/GuestUser.php diff --git a/src/GuestUser.php b/src/GuestUser.php new file mode 100644 index 00000000..0e61e65d --- /dev/null +++ b/src/GuestUser.php @@ -0,0 +1,40 @@ + 'datetime', + ]; +} diff --git a/src/Http/Middleware/GuestUser.php b/src/Http/Middleware/GuestUser.php new file mode 100644 index 00000000..dc10d2f8 --- /dev/null +++ b/src/Http/Middleware/GuestUser.php @@ -0,0 +1,27 @@ +share('signedIn', auth()->check()); + view()->share('user', auth()->user() ?: new \Acacha\User\GuestUser); + + return $next($request); + } +} \ No newline at end of file diff --git a/src/Providers/AdminLTETemplateServiceProvider.php b/src/Providers/AdminLTETemplateServiceProvider.php index 4552be40..346deb6c 100644 --- a/src/Providers/AdminLTETemplateServiceProvider.php +++ b/src/Providers/AdminLTETemplateServiceProvider.php @@ -2,11 +2,17 @@ namespace Acacha\AdminLTETemplateLaravel\Providers; +<<<<<<< Updated upstream use Acacha\AdminLTETemplateLaravel\Facades\AdminLTE; +======= +use Illuminate\Routing\Router; +use Illuminate\Support\ServiceProvider; +use Acacha\User\Http\Middleware\GuestUser; +>>>>>>> Stashed changes use Creativeorange\Gravatar\Facades\Gravatar; -use Creativeorange\Gravatar\GravatarServiceProvider; use Illuminate\Console\DetectsApplicationNamespace; -use Illuminate\Support\ServiceProvider; +use Acacha\AdminLTETemplateLaravel\Facades\AdminLTE; +use Creativeorange\Gravatar\GravatarServiceProvider; /** * Class AdminLTETemplateServiceProvider. @@ -71,8 +77,10 @@ class_alias(Gravatar::class, 'Gravatar'); /** * Bootstrap the application services. */ - public function boot() + public function boot(Router $router) { + $router->pushMiddlewareToGroup('web', GuestUser::class); + if (config('adminlte.install_routes', true)) { $this->defineRoutes(); } From f18fa8c413811fea084f9bc73df5bd75ff985828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manel=20Gavald=C3=A0?= Date: Fri, 17 Jul 2020 20:17:24 +0200 Subject: [PATCH 7/9] Stop publishing serviceprovider --- src/Http/Middleware/GuestUser.php | 2 +- .../AdminLTETemplateServiceProvider.php | 15 +--------- src/stubs/AppServiceProvider.php | 29 ------------------- 3 files changed, 2 insertions(+), 44 deletions(-) delete mode 100644 src/stubs/AppServiceProvider.php diff --git a/src/Http/Middleware/GuestUser.php b/src/Http/Middleware/GuestUser.php index dc10d2f8..653a56e4 100644 --- a/src/Http/Middleware/GuestUser.php +++ b/src/Http/Middleware/GuestUser.php @@ -1,6 +1,6 @@ >>>>>> Stashed changes use Creativeorange\Gravatar\Facades\Gravatar; use Illuminate\Console\DetectsApplicationNamespace; use Acacha\AdminLTETemplateLaravel\Facades\AdminLTE; use Creativeorange\Gravatar\GravatarServiceProvider; +use Acacha\AdminLTETemplateLaravel\Http\Middleware\GuestUser; /** * Class AdminLTETemplateServiceProvider. @@ -251,7 +247,6 @@ private function publishApiRoutes() private function publishDusk() { $this->publishDuskEnvironment(); - $this->publishAppServiceProvider(); } /** @@ -262,14 +257,6 @@ private function publishDuskEnvironment() $this->publishes(AdminLTE::duskEnvironment(), 'adminlte'); } - /** - * Publish app/Providers/AppServiceProvider.php file. - */ - private function publishAppServiceProvider() - { - $this->publishes(AdminLTE::appServiceProviderClass(), 'adminlte'); - } - /** * Publish database config files. */ diff --git a/src/stubs/AppServiceProvider.php b/src/stubs/AppServiceProvider.php deleted file mode 100644 index a3514827..00000000 --- a/src/stubs/AppServiceProvider.php +++ /dev/null @@ -1,29 +0,0 @@ - Date: Fri, 17 Jul 2020 20:32:32 +0200 Subject: [PATCH 8/9] Remove dumps and add guestuser middleware --- src/Http/Middleware/GuestUser.php | 2 +- tests/Browser/AcachaAdmintLTELaravelTest.php | 36 ++------------------ 2 files changed, 3 insertions(+), 35 deletions(-) diff --git a/src/Http/Middleware/GuestUser.php b/src/Http/Middleware/GuestUser.php index 653a56e4..9626617a 100644 --- a/src/Http/Middleware/GuestUser.php +++ b/src/Http/Middleware/GuestUser.php @@ -20,7 +20,7 @@ class GuestUser public function handle($request, Closure $next) { view()->share('signedIn', auth()->check()); - view()->share('user', auth()->user() ?: new \Acacha\User\GuestUser); + view()->share('user', auth()->user() ?: new \Acacha\AdminLTETemplateLaravel\GuestUser); return $next($request); } diff --git a/tests/Browser/AcachaAdmintLTELaravelTest.php b/tests/Browser/AcachaAdmintLTELaravelTest.php index 077f50a3..4936b153 100644 --- a/tests/Browser/AcachaAdmintLTELaravelTest.php +++ b/tests/Browser/AcachaAdmintLTELaravelTest.php @@ -2,10 +2,10 @@ namespace Tests\Browser; -use Illuminate\Support\Facades\Auth; -use Illuminate\Support\Facades\Hash; use Tests\DuskTestCase; use Laravel\Dusk\Browser; +use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\Hash; use Illuminate\Foundation\Testing\DatabaseMigrations; /** @@ -24,7 +24,6 @@ class AcachaAdmintLTELaravelTest extends DuskTestCase */ public function testLandingPage() { - dump('testLandingPage'); $this->browse(function (Browser $browser) { $browser->visit('/') ->assertSee('Acacha') @@ -53,7 +52,6 @@ private function logout() */ public function testLandingPageWithUserLogged() { - dump('testLandingPageWithUserLogged'); $this->browse(function (Browser $browser) { $user = factory(\App\User::class)->create(); $browser->loginAs($user) @@ -75,8 +73,6 @@ public function testLandingPageWithUserLogged() */ public function testLoginPage() { - dump('testLoginPage'); - $this->browse(function (Browser $browser) { $browser->visit('/login') ->assertSee('Sign in to start your session'); @@ -90,8 +86,6 @@ public function testLoginPage() */ public function testLogin() { - dump('testLogin'); - $this->browse(function (Browser $browser) { $user = factory(\App\User::class)->create(['password' => Hash::make('passw0RD')]); $browser->visit('/login') @@ -115,7 +109,6 @@ public function testLogin() */ public function testLoginRequiredFields() { - dump('testLoginRequiredFields'); $this->browse(function (Browser $browser) { $browser->visit('/login') ->type('email', '') @@ -134,7 +127,6 @@ public function testLoginRequiredFields() */ public function testLoginRequiredFieldsDisappearsOnKeyDown() { - dump('testLoginRequiredFieldsDissappearsOnKeyDown'); $this->browse(function (Browser $browser) { $browser->visit('/login') ->type('email', '') @@ -157,7 +149,6 @@ public function testLoginRequiredFieldsDisappearsOnKeyDown() */ public function testLoginCredentialsNotMatch() { - dump('testLoginCredentialsNotMatch'); $this->browse(function (Browser $browser) { $browser->visit('/login') ->type('email', 'emailquesegurquenoexisteix@sadsadsa.com') @@ -175,7 +166,6 @@ public function testLoginCredentialsNotMatch() */ public function testLoginCredentialsNotMatchDissappearsOnKeyDown() { - dump('testLoginCredentialsNotMatchDissappearsOnKeyDown'); $this->browse(function (Browser $browser) { $browser->visit('/login') ->type('email', 'emailquesegurquenoexisteix@sadsadsa.com') @@ -195,8 +185,6 @@ public function testLoginCredentialsNotMatchDissappearsOnKeyDown() */ public function testLoginWithRememberMe() { - dump('testLoginWithRememberMe'); - $this->browse(function (Browser $browser) { $user = factory(\App\User::class)->create(['password' => Hash::make('passw0RD')]); $browser->visit('/login') @@ -220,7 +208,6 @@ public function testLoginWithRememberMe() */ public function testRegisterPage() { - dump('testRegisterPage'); $this->browse(function (Browser $browser) { $browser->visit('/register') ->assertSee('Register a new membership'); @@ -234,7 +221,6 @@ public function testRegisterPage() */ public function testPasswordResetPage() { - dump('testPasswordResetPage'); $this->browse(function (Browser $browser) { $browser->visit('/password/reset') ->assertSee('Reset Password'); @@ -248,7 +234,6 @@ public function testPasswordResetPage() */ public function testHomePageForUnauthenticatedUsers() { - dump('testHomePageForUnauthenticatedUsers'); $this->browse(function (Browser $browser) { $user = factory(\App\User::class)->create(); view()->share('user', $user); @@ -265,8 +250,6 @@ public function testHomePageForUnauthenticatedUsers() */ public function testHomePageForAuthenticatedUsers() { - dump('testHomePageForAuthenticatedUsers'); - $this->browse(function (Browser $browser) { $user = factory(\App\User::class)->create(); view()->share('user', $user); @@ -285,7 +268,6 @@ public function testHomePageForAuthenticatedUsers() */ public function testLogout() { - dump('testLogout'); $this->browse(function (Browser $browser) { $user = factory(\App\User::class)->create(); view()->share('user', $user); @@ -306,7 +288,6 @@ public function testLogout() */ public function test404Page() { - dump('test404Page'); $this->browse(function (Browser $browser) { $browser->visit('/asdasdjlapmnnkadsdsa') ->assertSee('404'); @@ -320,7 +301,6 @@ public function test404Page() */ public function testNewUserRegistration() { - dump('testNewUserRegistration'); $this->browse(function (Browser $browser) { $browser->visit('/register') ->type('name', 'Sergi Tur Badenas') @@ -345,8 +325,6 @@ public function testNewUserRegistration() */ public function testNewUserRegistrationRequiredFields() { - dump('testNewUserRegistrationRequiredFields'); - $this->browse(function (Browser $browser) { $browser->visit('/register') ->type('name', '') @@ -368,8 +346,6 @@ public function testNewUserRegistrationRequiredFields() */ public function testNewUserRegistrationRequiredFieldsDissappearsOnKeyDown() { - dump('testNewUserRegistrationRequiredFieldsDissappearsOnKeyDown'); - $this->browse(function (Browser $browser) { $browser->visit('/register') ->type('name', '') @@ -399,8 +375,6 @@ public function testNewUserRegistrationRequiredFieldsDissappearsOnKeyDown() */ public function testSendPasswordReset() { - dump('testSendPasswordReset'); - $this->browse(function (Browser $browser) { $user = factory(\App\User::class)->create(); $browser->visit('password/reset') @@ -418,8 +392,6 @@ public function testSendPasswordReset() */ public function testSendPasswordResetUserNotExists() { - dump('testSendPasswordResetUserNotExists'); - $this->browse(function (Browser $browser) { $browser->visit('password/reset') ->type('email', 'notexistingemail@gmail.com') @@ -436,8 +408,6 @@ public function testSendPasswordResetUserNotExists() */ public function testSendPasswordResetRequiredFields() { - dump('testSendPasswordResetRequiredFields'); - $this->browse(function (Browser $browser) { $browser->visit('password/reset') ->press('Send Password Reset Link') @@ -453,8 +423,6 @@ public function testSendPasswordResetRequiredFields() */ public function testSendPasswordResetRequiredFieldsDisappearsOnKeyDown() { - dump('testSendPasswordResetRequiredFieldsDisappearsOnKeyDown'); - $this->browse(function (Browser $browser) { $browser->visit('password/reset') ->type('email', '') From 435afdad62af9f795663e483112b08bf9e39991e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manel=20Gavald=C3=A0?= Date: Fri, 17 Jul 2020 20:49:44 +0200 Subject: [PATCH 9/9] Readme update --- README.md | 45 ++++++--------------------------------------- 1 file changed, 6 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 90a74703..3df78559 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -# AdminLTE template Laravel 5 package -A Laravel 5 package that switch default Laravel scaffolding / boilerplate to AdminLTE template with Bootstrap 3.0 and Pratt Landing Page +# AdminLTE template Laravel package +A Laravel package that switch default Laravel scaffolding / boilerplate to AdminLTE template with Bootstrap 3.0 and Pratt Landing Page See demo here: @@ -17,31 +17,12 @@ If you are looking for the Laravel 4 version, use 0.1.5 version/tag and see [OLD [![StyleCI](https://styleci.io/repos/35628567/shield)](https://styleci.io/repos/35628567) [![Build Status](https://travis-ci.org/acacha/adminlte-laravel.svg?branch=master)](https://travis-ci.org/acacha/adminlte-laravel) -# Installation & use - -**So easy to install!** Install globally with composer: - -```bash -composer global require "acacha/adminlte-laravel-installer" -``` - -And convert any Laravel installation to AdminLTE/Pratt with: - -```bash -laravel new laravel-with-admin-lte -cd laravel-with-admin-lte -adminlte-laravel install -``` -Enjoy! If you wish you can use [llum](https://github.com/acacha/llum) to start your app: +# Installation ```bash -llum boot +composer require "acacha/admin-lte-template-laravel" ``` -To start using you Laravel with AdminLTE. Llum will configure database (sqlite),execute migrations, install devtools and serve for you. - -More info about llum commands in Github [Acacha/llum](https://github.com/acacha/llum). - # Requirements This packages use (no need to install): @@ -50,12 +31,10 @@ This packages use (no need to install): * [Laravel](http://laravel.com/) * [AdminLTE](https://github.com/almasaeed2010/AdminLTE). You can see and AdminLTE theme preview at: http://almsaeedstudio.com/preview/ * [Pratt](http://blacktie.co/demo/pratt/). Pratt Landing Page -* [Acacha/user](https://github.com/acacha/user): providing boosted Laravel Users. This could be optional through configuration. * [acacha/helpers](https://github.com/acacha/helpers) : Extra helpers for Laravel provided by acacha. * [creativeorange/gravatar](https://github.com/creativeorange/gravatar): Gravatar support for user's profile images. This could be optional through configuration. * [league/flysystem](https://github.com/thephpleague/flysystem) : Filesystem support. * [acacha/forms](https://github.com/acacha/forms) : Javascript Form objects implementation. -* [acacha/llum](https://github.com/acacha/llum). Easy Laravel packages installation (and other tasks). Used to modify config/app.php file without using stubs (so you changes to this file would be respected) * [thephpleague/skeleton](https://github.com/thephpleague/skeleton). This package use/has been adapted to use the phpleague skeleton. * Acacha llum requires GNU sed. on MAC OS install GNU sed with: @@ -88,21 +67,9 @@ Please be sure to check you environment. ## Optional requirements * [Laravel menu](https://github.com/spatie/laravel-menu): only used with command adminlte:menu that replaces default adminlte menu with a menu with spatie/laravel-menu support. -## Laravel 5.8 - -This package works smoothly with Laravel 5.8 with 6.2 version. - -## Laravel 5.7 - -This package works smoothly with Laravel 5.7 with 6.1 version. - -## Laravel 5.6 - -This package works smoothly with Laravel 5.6 with 6.1 version. - -## Laravel 5.5 +## Laravel 5.8 and older -This package now use new Laravel 5.5 feature Package Auto Discover. +This package works smoothly with Laravel 5.x with 6.x version ## Laravel 5.4