From 1b2e77d90741b8c6febebbdf6009323afe38aa60 Mon Sep 17 00:00:00 2001 From: Arno Kaimbacher Date: Fri, 5 Aug 2022 13:26:42 +0200 Subject: [PATCH] - Convert class references from strings to static ::class constants built-in to PHP for improved code completion and static analysis. - Replace Facade references using the global namespace with their FQCN for improved code completion and static analysis. - delete database\factories\PageFactory.php and app\services\Registrar.php --- app/Console/Kernel.php | 11 ++--- app/Http/Controllers/Auth/LoginController.php | 1 + app/Http/Controllers/Controller.php | 7 ++-- .../Frontend/LocalizationController.php | 8 ++-- app/Http/Middleware/LocaleSessionRedirect.php | 8 ++-- app/Models/Person.php | 9 +++-- app/Providers/DoiServiceProvider.php | 2 +- app/Providers/EventServiceProvider.php | 4 +- app/Services/Registrar.php | 40 ------------------- config/entrust.php | 6 +-- config/services.php | 2 +- database/factories/PageFactory.php | 22 ---------- 12 files changed, 32 insertions(+), 88 deletions(-) delete mode 100755 app/Services/Registrar.php delete mode 100644 database/factories/PageFactory.php diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 2e482ee..d848762 100755 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -1,4 +1,5 @@ session()->flush(); $request->session()->regenerate(); $frontend = config('tethys.frontend'); + return redirect($frontend); } } diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 2f7a1d3..b7d786e 100755 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -1,11 +1,12 @@ first_name . " " . $this->last_name . " " . $this->date_of_birth; + return $this->first_name.' '.$this->last_name.' '.$this->date_of_birth; } public function scopeActive($query) diff --git a/app/Providers/DoiServiceProvider.php b/app/Providers/DoiServiceProvider.php index 8a4775d..fa133a1 100644 --- a/app/Providers/DoiServiceProvider.php +++ b/app/Providers/DoiServiceProvider.php @@ -33,7 +33,7 @@ class DoiServiceProvider extends ServiceProvider public function register() { // - $this->app->singleton('App\Interfaces\DoiInterface', function ($app) { + $this->app->singleton(\App\Interfaces\DoiInterface::class, function ($app) { return new DoiClient(); }); } diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index ca973a3..26aaf79 100755 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -11,8 +11,8 @@ class EventServiceProvider extends ServiceProvider * @var array */ protected $listen = [ - 'App\Events\Event' => [ - 'App\Listeners\EventListener', + \App\Events\Event::class => [ + \App\Listeners\EventListener::class, ], \App\Events\Dataset\DatasetUpdated::class => [ \App\Listeners\DatasetUpdated::class, diff --git a/app/Services/Registrar.php b/app/Services/Registrar.php deleted file mode 100755 index 42bf1ce..0000000 --- a/app/Services/Registrar.php +++ /dev/null @@ -1,40 +0,0 @@ - 'required|max:255', - 'email' => 'required|email|max:255|unique:users', - 'password' => 'required|confirmed|min:6', - ]); - } - - /** - * Create a new user instance after a valid registration. - * - * @param array $data - * @return User - */ - public function create(array $data) - { - return User::create([ - 'name' => $data['name'], - 'email' => $data['email'], - 'password' => bcrypt($data['password']), - ]); - } -} diff --git a/config/entrust.php b/config/entrust.php index b103523..7695d1a 100644 --- a/config/entrust.php +++ b/config/entrust.php @@ -19,7 +19,7 @@ return [ | the role if it is in a different namespace. | */ - 'role' => 'App\Models\Role', + 'role' => App\Models\Role::class, /* |-------------------------------------------------------------------------- @@ -51,7 +51,7 @@ return [ | Update the User if it is in a different namespace. | */ - 'user' => 'App\Models\User', + 'user' => App\Models\User::class, /* |-------------------------------------------------------------------------- @@ -95,7 +95,7 @@ return [ | Update the permission if it is in a different namespace. | */ - 'permission' => 'App\Models\Permission', + 'permission' => App\Models\Permission::class, /* |-------------------------------------------------------------------------- diff --git a/config/services.php b/config/services.php index 62ac69e..0b15ba6 100755 --- a/config/services.php +++ b/config/services.php @@ -30,7 +30,7 @@ return [ ], 'stripe' => [ - 'model' => 'App\Models\User', + 'model' => App\Models\User::class, 'secret' => '', ], diff --git a/database/factories/PageFactory.php b/database/factories/PageFactory.php deleted file mode 100644 index b5c19b1..0000000 --- a/database/factories/PageFactory.php +++ /dev/null @@ -1,22 +0,0 @@ -define(Page::class, function (Faker $faker) { - $title = $faker->sentence; - - // $newestPage = Page::orderBy('id', 'desc')->first(); - - return [ - 'title' => $title, - 'page_slug' => str_slug($title), - 'description' => $faker->paragraph, - 'cannonical_link' => 'http://localhost/'.str_slug($title), - 'created_by' => 1, - 'status' => 1, - 'created_at' => Carbon\Carbon::now(), - 'updated_at' => Carbon\Carbon::now(), - ]; -});