fix: php-cs-fixed fix
This commit is contained in:
parent
c320d10e08
commit
9922ebbc39
|
@ -7,4 +7,4 @@ class Filter
|
|||
public FilterTypeEnum $type;
|
||||
public string $column;
|
||||
public mixed $filter;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,4 +7,4 @@ enum FilterTypeEnum: string
|
|||
case Is = 'is';
|
||||
case Not = 'not';
|
||||
case Like = 'like';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ use JsonMapper;
|
|||
|
||||
class Filters
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Filter[]
|
||||
*/
|
||||
|
@ -30,7 +29,7 @@ class Filters
|
|||
if (is_array($data)) {
|
||||
$data = json_decode(json_encode($data), false);
|
||||
}
|
||||
|
||||
|
||||
$data->filters ??= [];
|
||||
$data->orders ??= [];
|
||||
$data->pagination ??= null;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,4 +6,4 @@ enum OrderTypeEnum: string
|
|||
{
|
||||
case Asc = 'asc';
|
||||
case Desc = 'desc';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,4 +6,4 @@ class Pagination
|
|||
{
|
||||
public int $size;
|
||||
public int $page;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use App\Models\History;
|
||||
|
||||
class HistoryObserver
|
||||
|
|
|
@ -11,8 +11,9 @@ class PrivateUserController extends Controller
|
|||
{
|
||||
public function __construct(
|
||||
private UserService $userService
|
||||
) { }
|
||||
|
||||
) {
|
||||
}
|
||||
|
||||
public function list(AuthorizedRequest $request)
|
||||
{
|
||||
return $this->userService->listAll();
|
||||
|
|
|
@ -10,7 +10,8 @@ class PublicUserController extends Controller
|
|||
{
|
||||
public function __construct(
|
||||
private UserService $userService
|
||||
) { }
|
||||
) {
|
||||
}
|
||||
|
||||
public function register(RegisterRequest $request)
|
||||
{
|
||||
|
|
|
@ -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() ])],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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() ])],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -9,7 +9,8 @@ use Illuminate\Database\Eloquent\Model;
|
|||
|
||||
class History extends Model
|
||||
{
|
||||
use HasFactory, UuidId;
|
||||
use HasFactory;
|
||||
use UuidId;
|
||||
|
||||
protected $fillable = [
|
||||
'model_id',
|
||||
|
|
|
@ -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+$/';
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
@ -102,4 +102,4 @@ class UserService
|
|||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\User;
|
||||
|
||||
class UserTrashService
|
||||
|
@ -10,7 +11,7 @@ class UserTrashService
|
|||
) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function moveUsersToTrash(array $ids): bool | array
|
||||
{
|
||||
$unexisting = $this->userService->getUnexistingIds($ids);
|
||||
|
|
|
@ -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';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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));
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue