- 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
This commit is contained in:
Arno Kaimbacher 2022-08-05 13:26:42 +02:00
parent c4d74ca631
commit 1b2e77d907
12 changed files with 32 additions and 88 deletions

View File

@ -1,4 +1,5 @@
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
@ -12,11 +13,11 @@ class Kernel extends ConsoleKernel
* @var array
*/
protected $commands = [
'App\Console\Commands\Inspire',
'App\Console\Commands\DatasetState',
'App\Console\Commands\SolrIndexBuilder',
'App\Console\Commands\Log\ClearLogFile',
'App\Console\Commands\UpdateSolrDataset'
\App\Console\Commands\Inspire::class,
\App\Console\Commands\DatasetState::class,
\App\Console\Commands\SolrIndexBuilder::class,
\App\Console\Commands\Log\ClearLogFile::class,
\App\Console\Commands\UpdateSolrDataset::class,
];
/**

View File

@ -53,6 +53,7 @@ class LoginController extends Controller
$request->session()->flush();
$request->session()->regenerate();
$frontend = config('tethys.frontend');
return redirect($frontend);
}
}

View File

@ -1,11 +1,12 @@
<?php
namespace App\Http\Controllers;
//use Illuminate\Foundation\Bus\DispatchesCommands;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
abstract class Controller extends BaseController
{

View File

@ -2,10 +2,10 @@
namespace App\Http\Controllers\Frontend;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input;
use Session;
use App;
// use Illuminate\Http\Request;
// use Illuminate\Support\Facades\Input;
// use Illuminate\Support\Facades\Session;
// use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Redirect;
use App\Http\Controllers\Controller;

View File

@ -3,10 +3,10 @@
namespace App\Http\Middleware;
use Closure;
use Session;
use App;
use Config;
use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\App;
// use Illuminate\Support\Facades\Config;
// use Illuminate\Http\RedirectResponse;
use Mcamara\LaravelLocalization\LanguageNegotiator;
class LocaleSessionRedirect extends LaravelLocalizationMiddlewareBase

View File

@ -1,4 +1,5 @@
<?php
namespace App\Models;
use App\Models\Dataset;
@ -6,7 +7,6 @@ use Illuminate\Database\Eloquent\Model;
class Person extends Model
{
protected $fillable = [
'academic_title',
'date_of_birth',
@ -15,10 +15,13 @@ class Person extends Model
'email',
'identifier_orcid',
'status',
'name_type'
'name_type',
];
protected $table = 'persons';
public $timestamps = false;
protected $appends = ['full_name'];
public function documents()
@ -39,7 +42,7 @@ class Person extends Model
*/
public function getFullNameAttribute()
{
return $this->first_name . " " . $this->last_name . " " . $this->date_of_birth;
return $this->first_name.' '.$this->last_name.' '.$this->date_of_birth;
}
public function scopeActive($query)

View File

@ -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();
});
}

View File

@ -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,

View File

@ -1,40 +0,0 @@
<?php
namespace App\Services;
use App\Models\User;
use Validator;
use Illuminate\Contracts\Auth\Registrar as RegistrarContract;
class Registrar implements RegistrarContract
{
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
public function validator(array $data)
{
return Validator::make($data, [
'name' => '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']),
]);
}
}

View File

@ -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,
/*
|--------------------------------------------------------------------------

View File

@ -30,7 +30,7 @@ return [
],
'stripe' => [
'model' => 'App\Models\User',
'model' => App\Models\User::class,
'secret' => '',
],

View File

@ -1,22 +0,0 @@
<?php
use App\Models\Access\User\User;
use App\Models\Page;
use Faker\Generator as Faker;
$factory->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(),
];
});