- 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:
parent
c4d74ca631
commit
1b2e77d907
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Console;
|
namespace App\Console;
|
||||||
|
|
||||||
use Illuminate\Console\Scheduling\Schedule;
|
use Illuminate\Console\Scheduling\Schedule;
|
||||||
|
@ -12,11 +13,11 @@ class Kernel extends ConsoleKernel
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $commands = [
|
protected $commands = [
|
||||||
'App\Console\Commands\Inspire',
|
\App\Console\Commands\Inspire::class,
|
||||||
'App\Console\Commands\DatasetState',
|
\App\Console\Commands\DatasetState::class,
|
||||||
'App\Console\Commands\SolrIndexBuilder',
|
\App\Console\Commands\SolrIndexBuilder::class,
|
||||||
'App\Console\Commands\Log\ClearLogFile',
|
\App\Console\Commands\Log\ClearLogFile::class,
|
||||||
'App\Console\Commands\UpdateSolrDataset'
|
\App\Console\Commands\UpdateSolrDataset::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -53,6 +53,7 @@ class LoginController extends Controller
|
||||||
$request->session()->flush();
|
$request->session()->flush();
|
||||||
$request->session()->regenerate();
|
$request->session()->regenerate();
|
||||||
$frontend = config('tethys.frontend');
|
$frontend = config('tethys.frontend');
|
||||||
|
|
||||||
return redirect($frontend);
|
return redirect($frontend);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
//use Illuminate\Foundation\Bus\DispatchesCommands;
|
//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\Auth\Access\AuthorizesRequests;
|
||||||
|
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||||
|
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||||
|
use Illuminate\Routing\Controller as BaseController;
|
||||||
|
|
||||||
abstract class Controller extends BaseController
|
abstract class Controller extends BaseController
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers\Frontend;
|
namespace App\Http\Controllers\Frontend;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
// use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Input;
|
// use Illuminate\Support\Facades\Input;
|
||||||
use Session;
|
// use Illuminate\Support\Facades\Session;
|
||||||
use App;
|
// use Illuminate\Support\Facades\App;
|
||||||
use Illuminate\Support\Facades\Redirect;
|
use Illuminate\Support\Facades\Redirect;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
namespace App\Http\Middleware;
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
use Session;
|
use Illuminate\Support\Facades\Session;
|
||||||
use App;
|
use Illuminate\Support\Facades\App;
|
||||||
use Config;
|
// use Illuminate\Support\Facades\Config;
|
||||||
use Illuminate\Http\RedirectResponse;
|
// use Illuminate\Http\RedirectResponse;
|
||||||
use Mcamara\LaravelLocalization\LanguageNegotiator;
|
use Mcamara\LaravelLocalization\LanguageNegotiator;
|
||||||
|
|
||||||
class LocaleSessionRedirect extends LaravelLocalizationMiddlewareBase
|
class LocaleSessionRedirect extends LaravelLocalizationMiddlewareBase
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use App\Models\Dataset;
|
use App\Models\Dataset;
|
||||||
|
@ -6,7 +7,6 @@ use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class Person extends Model
|
class Person extends Model
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'academic_title',
|
'academic_title',
|
||||||
'date_of_birth',
|
'date_of_birth',
|
||||||
|
@ -15,10 +15,13 @@ class Person extends Model
|
||||||
'email',
|
'email',
|
||||||
'identifier_orcid',
|
'identifier_orcid',
|
||||||
'status',
|
'status',
|
||||||
'name_type'
|
'name_type',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $table = 'persons';
|
protected $table = 'persons';
|
||||||
|
|
||||||
public $timestamps = false;
|
public $timestamps = false;
|
||||||
|
|
||||||
protected $appends = ['full_name'];
|
protected $appends = ['full_name'];
|
||||||
|
|
||||||
public function documents()
|
public function documents()
|
||||||
|
@ -39,7 +42,7 @@ class Person extends Model
|
||||||
*/
|
*/
|
||||||
public function getFullNameAttribute()
|
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)
|
public function scopeActive($query)
|
||||||
|
|
|
@ -33,7 +33,7 @@ class DoiServiceProvider extends ServiceProvider
|
||||||
public function register()
|
public function register()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
$this->app->singleton('App\Interfaces\DoiInterface', function ($app) {
|
$this->app->singleton(\App\Interfaces\DoiInterface::class, function ($app) {
|
||||||
return new DoiClient();
|
return new DoiClient();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,8 @@ class EventServiceProvider extends ServiceProvider
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $listen = [
|
protected $listen = [
|
||||||
'App\Events\Event' => [
|
\App\Events\Event::class => [
|
||||||
'App\Listeners\EventListener',
|
\App\Listeners\EventListener::class,
|
||||||
],
|
],
|
||||||
\App\Events\Dataset\DatasetUpdated::class => [
|
\App\Events\Dataset\DatasetUpdated::class => [
|
||||||
\App\Listeners\DatasetUpdated::class,
|
\App\Listeners\DatasetUpdated::class,
|
||||||
|
|
|
@ -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']),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -19,7 +19,7 @@ return [
|
||||||
| the role if it is in a different namespace.
|
| 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.
|
| 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.
|
| Update the permission if it is in a different namespace.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
'permission' => 'App\Models\Permission',
|
'permission' => App\Models\Permission::class,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
@ -30,7 +30,7 @@ return [
|
||||||
],
|
],
|
||||||
|
|
||||||
'stripe' => [
|
'stripe' => [
|
||||||
'model' => 'App\Models\User',
|
'model' => App\Models\User::class,
|
||||||
'secret' => '',
|
'secret' => '',
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
|
@ -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(),
|
|
||||||
];
|
|
||||||
});
|
|
Loading…
Reference in New Issue
Block a user