mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-11-22 00:03:09 +01:00
Fix multiple issues detected by static analysis
This commit is contained in:
parent
017bbc6304
commit
b6a0e5055c
@ -18,7 +18,7 @@ class TwoFAccountCollection extends ResourceCollection
|
||||
* Transform the resource collection into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Support\Collection
|
||||
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
|
@ -20,9 +20,9 @@ class UserResource extends JsonResource
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'id' => $this->when($request->user(), $this->id),
|
||||
'id' => $this->when(!is_null($request->user()), $this->id),
|
||||
'name' => $this->name,
|
||||
'email' => $this->when($request->user(), $this->email),
|
||||
'email' => $this->when(!is_null($request->user()), $this->email),
|
||||
];
|
||||
}
|
||||
}
|
@ -18,7 +18,7 @@ class Handler extends ExceptionHandler
|
||||
/**
|
||||
* A list of the exception types that are not reported.
|
||||
*
|
||||
* @var string[]
|
||||
* @var array<int, class-string<\Throwable>>
|
||||
*/
|
||||
protected $dontReport = [
|
||||
//
|
||||
@ -27,7 +27,7 @@ class Handler extends ExceptionHandler
|
||||
/**
|
||||
* A list of the inputs that are never flashed for validation exceptions.
|
||||
*
|
||||
* @var string[]
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $dontFlash = [
|
||||
'current_password',
|
||||
|
@ -15,6 +15,6 @@ class CustomCreateFreshApiToken extends CreateFreshApiToken
|
||||
*/
|
||||
protected function requestShouldReceiveFreshToken($request)
|
||||
{
|
||||
return $request->user($this->guard);
|
||||
return !is_null($request->user($this->guard));
|
||||
}
|
||||
}
|
@ -28,12 +28,11 @@ public function handle($request, Closure $next)
|
||||
|
||||
if($lang === 'browser') {
|
||||
$lang = config('app.fallback_locale');
|
||||
$accepted = $request->header("Accept-Language");
|
||||
$accepted = str_replace(' ', '', $request->header("Accept-Language"));
|
||||
|
||||
if ($accepted) {
|
||||
$accepted = is_array($accepted) ? implode(',', $accepted) : $accepted;
|
||||
if ($accepted && $accepted !== '*') {
|
||||
$prefLocales = array_reduce(
|
||||
explode(',', $accepted),
|
||||
array_diff(explode(',', $accepted), ['*']),
|
||||
function ($res, $el) {
|
||||
list($l, $q) = array_merge(explode(';q=', $el), [1]);
|
||||
$res[$l] = (float) $q;
|
||||
|
@ -34,7 +34,7 @@ class Group extends Model
|
||||
/**
|
||||
* The attributes that should be hidden for arrays.
|
||||
*
|
||||
* @var array
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $hidden = ['created_at', 'updated_at'];
|
||||
|
||||
@ -42,7 +42,7 @@ class Group extends Model
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'twofaccounts_count' => 'integer',
|
||||
|
@ -29,7 +29,7 @@ class Option extends Model
|
||||
/**
|
||||
* Casts.
|
||||
*
|
||||
* @var array
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [];
|
||||
|
||||
|
@ -111,7 +111,7 @@ class TwoFAccount extends Model implements Sortable
|
||||
/**
|
||||
* The attributes that should be hidden for arrays.
|
||||
*
|
||||
* @var array
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $hidden = [];
|
||||
|
||||
@ -119,7 +119,7 @@ class TwoFAccount extends Model implements Sortable
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [];
|
||||
|
||||
|
@ -16,11 +16,9 @@ public function up()
|
||||
Schema::table('twofaccounts', function (Blueprint $table) {
|
||||
$table->unsignedInteger('group_id')
|
||||
->after('id')
|
||||
->nullable()
|
||||
->constrained()
|
||||
->onDelete('set null');
|
||||
->nullable();
|
||||
|
||||
$table->foreign('group_id')->references('id')->on('groups');
|
||||
$table->foreign('group_id')->references('id')->on('groups')->onDelete('set null');
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Foundation\Inspiring;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
// use Illuminate\Foundation\Inspiring;
|
||||
// use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@ -14,6 +14,6 @@
|
||||
|
|
||||
*/
|
||||
|
||||
Artisan::command('inspire', function () {
|
||||
$this->comment(Inspiring::quote());
|
||||
})->purpose('Display an inspiring quote');
|
||||
// Artisan::command('inspire', function () {
|
||||
// $this->comment(Inspiring::quote());
|
||||
// })->purpose('Display an inspiring quote');
|
||||
|
Loading…
Reference in New Issue
Block a user