fix: php-cs-fixed fix

This commit is contained in:
b1ek 2024-08-30 17:37:24 +10:00
parent c320d10e08
commit 9922ebbc39
Signed by: blek
GPG Key ID: 14546221E3595D0C
22 changed files with 42 additions and 37 deletions

View File

@ -11,7 +11,6 @@ use JsonMapper;
class Filters
{
/**
* @var Filter[]
*/
@ -63,7 +62,7 @@ class Filters
}
if (!is_null($this->pagination)) {
$builder->paginate($this->pagination->size , ['*'], 'page', $this->pagination->page);
$builder->paginate($this->pagination->size, ['*'], 'page', $this->pagination->page);
}
}
}

View File

@ -1,6 +1,7 @@
<?php
namespace App;
use App\Models\History;
class HistoryObserver

View File

@ -11,7 +11,8 @@ class PrivateUserController extends Controller
{
public function __construct(
private UserService $userService
) { }
) {
}
public function list(AuthorizedRequest $request)
{

View File

@ -10,7 +10,8 @@ class PublicUserController extends Controller
{
public function __construct(
private UserService $userService
) { }
) {
}
public function register(RegisterRequest $request)
{

View File

@ -25,7 +25,7 @@ class LoginRequest extends RestRequest
{
return [
'email' => ['required', 'email'],
'password' => ['required', Password::min(1)->rules([ new ZxcvbnRule ])],
'password' => ['required', Password::min(1)->rules([ new ZxcvbnRule() ])],
];
}
}

View File

@ -30,7 +30,7 @@ class RegisterRequest extends RestRequest
'middle_name' => ['required', 'string'],
'email' => ['required', 'email'],
'phone' => ['required', 'regex:' . User::PHONE_REGEX ],
'password' => ['required', Password::min(1)->rules([ new ZxcvbnRule ])],
'password' => ['required', Password::min(1)->rules([ new ZxcvbnRule() ])],
];
}
}

View File

@ -9,7 +9,6 @@ use Illuminate\Validation\Rules\Password;
class UserEditRequest extends AuthorizedRequest
{
/**
* Get the validation rules that apply to the request.
*
@ -24,7 +23,7 @@ class UserEditRequest extends AuthorizedRequest
'user.email' => [ 'email' ],
'user.phone' => [ 'string', 'regex:' . User::PHONE_REGEX ],
'user' => 'required',
'password' => [ Password::min(1)->rules([ new ZxcvbnRule ]) ],
'password' => [ Password::min(1)->rules([ new ZxcvbnRule() ]) ],
'user.email_verified_at' => 'prohibited',
'user.created_at' => 'prohibited',

View File

@ -9,7 +9,8 @@ use Illuminate\Database\Eloquent\Model;
class History extends Model
{
use HasFactory, UuidId;
use HasFactory;
use UuidId;
protected $fillable = [
'model_id',

View File

@ -11,7 +11,10 @@ use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
use HasFactory, Notifiable, UuidId, HasHistory;
use HasFactory;
use Notifiable;
use UuidId;
use HasHistory;
public const PHONE_REGEX = '/^\+\d+$/';

View File

@ -94,7 +94,7 @@ class UserService
$users = User::whereIn('id', $ids)->get();
if ($users->count() != count($ids)) {
$existingIds = $users->map(
function($model) {
function ($model) {
return $model->id;
}
)->toArray();

View File

@ -1,6 +1,7 @@
<?php
namespace App\Services;
use App\Models\User;
class UserTrashService

View File

@ -1,20 +1,24 @@
<?php
namespace App;
use Ramsey\Uuid\Uuid;
trait UuidId
{
protected static function boot() {
protected static function boot()
{
parent::boot();
static::creating(function ($model) {
$model->id = Uuid::uuid6()->toString();
});
}
public function getIncrementing(): bool {
public function getIncrementing(): bool
{
return false;
}
public function getKeyType(): string {
public function getKeyType(): string
{
return 'string';
}
}

View File

@ -5,8 +5,7 @@ use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Schema\Builder;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class () extends Migration {
/**
* Run the migrations.
*/

View File

@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class () extends Migration {
/**
* Run the migrations.
*/

View File

@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class () extends Migration {
/**
* Run the migrations.
*/

View File

@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class () extends Migration {
/**
* Run the migrations.
*/

View File

@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class () extends Migration {
/**
* Run the migrations.
*/

View File

@ -5,12 +5,12 @@ use App\Http\Controllers\PublicUserController;
use App\Http\Controllers\TrashUserController;
use Illuminate\Support\Facades\Route;
Route::get('/', function() {
Route::get('/', function () {
return view('welcome');
});
Route::prefix('/api')->group(function() {
Route::controller(PublicUserController::class)->prefix('/users')->group(function() {
Route::prefix('/api')->group(function () {
Route::controller(PublicUserController::class)->prefix('/users')->group(function () {
Route::put('/register', 'register');
Route::post('/login', 'login');
Route::post('/reset', 'reset');
@ -28,6 +28,6 @@ Route::prefix('/api')->group(function() {
});
});
Route::get('/session', function() {
Route::get('/session', function () {
exit(print_r(session()->all(), true));
});