restore composer.json, add mysqli extension

This commit is contained in:
2026-04-15 17:02:52 +05:00
commit 77cf56a348
4317 changed files with 1397107 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
<?php
namespace App\Http\Requests\Api\Auth;
use Illuminate\Foundation\Http\FormRequest;
class Login extends FormRequest
{
public function prepareForValidation()
{
$this->merge([
'phone' => str_replace(['+', '(', ')', '-', ' '], '', $this->phone),
]);
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'phone' => [
'required',
'string',
'regex:/(998)(90|91|92|93|94|95|96|97|98|99|33|88)[0-9]{7}/',
],
];
}
/**
* @return int
*/
public function getPhone(): int
{
return (int) str_replace(['+', '(', ')', '-', ' '], '', $this->get('phone'));
}
}

View File

@@ -0,0 +1,53 @@
<?php
namespace App\Http\Requests\Api\Auth;
use Illuminate\Foundation\Http\FormRequest;
class Password extends FormRequest
{
/**
*
*/
public function prepareForValidation()
{
$this->merge([
'phone' => str_replace(['+', '(', ')', '-', ' '], '', $this->phone),
]);
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'phone' => [
'required',
'string',
'regex:/(998)(90|91|92|93|94|95|96|97|98|99|33|88)[0-9]{7}/',
],
'password' => 'required'
];
}
/**
* @return int
*/
public function getPhone(): int
{
return (int) str_replace(['+', '(', ')', '-', ' '], '', $this->get('phone'));
}
public function getRemember(): bool
{
if ($this->get('remember')) {
return true;
}
return false;
}
}

View File

@@ -0,0 +1,48 @@
<?php
namespace App\Http\Requests\Api\Auth;
use Illuminate\Foundation\Http\FormRequest;
class Register extends FormRequest
{
/**
*
*/
public function prepareForValidation()
{
$this->merge([
'phone' => str_replace(['+', '(', ')', '-', ' '], '', $this->phone),
]);
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'phone' => 'required|numeric',
'password' => 'required|confirmed|min:6'
];
}
public function messages()
{
return [
'password.confirmed' => trans('vue.login.confirmed'),
'password.min' => trans('vue.login.min')
];
}
/**
* @return int
*/
public function getPhone(): int
{
return (int) str_replace(['+', '(', ')', '-', ' '], '', $this->get('phone'));
}
}

View File

@@ -0,0 +1,48 @@
<?php
namespace App\Http\Requests\Api\Auth;
use Illuminate\Foundation\Http\FormRequest;
class Verify extends FormRequest
{
public function prepareForValidation()
{
$this->merge([
'phone' => str_replace(['+', '(', ')', '-', ' '], '', $this->phone),
]);
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'phone' => [
'required',
'string',
'regex:/(998)(90|91|92|93|94|95|96|97|98|99|33|88)[0-9]{7}/',
],
'code' => 'required|numeric|min:6'
];
}
/**
* @return int
*/
public function getPhone(): int
{
return (int) str_replace(['+', '(', ')', '-', ' '], '', $this->get('phone'));
}
/**
* @return int
*/
public function getCode(): int
{
return (int) $this->get('code');
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Http\Requests\Api\Card;
use Illuminate\Foundation\Http\FormRequest;
class Request extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'products' => 'array|required',
'products.*.id' => 'required',
'products.*.count' => 'required',
'products.*.size' => 'required',
'products.*.color_id' => 'required',
];
}
/**
* @return array|null
*/
public function getProducts()
{
return $this->get('products');
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace App\Http\Requests\Api\Checkout;
use Illuminate\Foundation\Http\FormRequest;
class CheckoutRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'type' => 'required|in:ready_solutions,single_products',
'delivery_type' => 'required|in:delivery,pickup',
'branch_id' => 'required_if:delivery_type,pickup|exists:branches,id',
'client_type' => 'required|in:physical,legal',
'client_information' => 'required_if:client_type,physical|array',
'client_information.full_name' => 'required_if:client_type,physical|string',
'client_information.phone' => 'required_if:client_type,physical|numeric',
'client_information.director_full_name' => 'required_if:client_type,legal|string',
'client_information.company_name' => 'required_if:client_type,legal|string',
'client_information.inn' => 'required_if:client_type,legal|string',
'client_information.bank_name' => 'required_if:client_type,legal|string',
'client_information.mfo' => 'required_if:client_type,legal|string',
'client_information.oked' => 'required_if:client_type,legal|string',
'client_information.payment_account' => 'required_if:client_type,legal|string',
'client_information.address' => 'required_if:client_type,legal|string',
'client_information.email' => 'nullable|email',
'client_information.phone' => 'required_if:client_type,legal|numeric', //
'client_information.jshir' => 'required_if:client_type,physical|numeric', //
'client_information.series' => 'required_if:client_type,physical', //
'address' => 'required_if:delivery_type,delivery|array',
'address.city_id' => 'required_if:delivery_type,delivery|exists:cities,id',
'address.address' => 'required_if:delivery_type,delivery|string',
'address.home' => 'nullable',
'address.landmark' => 'nullable',
'with_installation' => 'required_if:type,ready_solutions|boolean',
'payment_type' => 'required|in:cash,bank,click,payme',
'with_didox' => 'required_if:payment_type,bank|boolean',
'products' => 'required|array',
'products.*.id' => 'required|exists:products,id',
'products.*.count' => 'required|integer|min:1',
];
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Http\Requests\Api\Favorites;
use Illuminate\Foundation\Http\FormRequest;
class Request extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'id' => 'required'
];
}
public function getID(): int
{
return $this->get('id');
}
}

View File

@@ -0,0 +1,77 @@
<?php
namespace App\Http\Requests\Api\Filter;
use Illuminate\Foundation\Http\FormRequest;
class Request extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'categories' => 'nullable|array',
'brands' => 'nullable|array',
'brands.*' => 'required',
'sizes' => 'nullable',
//'sizes.*' => 'required',
'colors' => 'nullable|array',
'colors.*' => 'required',
'price_from' => 'nullable|numeric',
'price_before' => 'nullable|numeric'
];
}
/**
* @return array|null
*/
public function getCategories()
{
return $this->get('categories');
}
/**
* @return array|null
*/
public function getBrand()
{
return $this->get('brands');
}
public function getSizes()
{
return $this->get('sizes');
}
/**
* @return array|null
*/
public function getColors()
{
return $this->get('colors');
}
/**
* @return int|null
*/
public function getPriceFrom()
{
return $this->get('price_from');
}
/**
* @return int|null
*/
public function getPriceBefore()
{
return $this->get('price_before');
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Http\Requests\Api\Firebase;
use Illuminate\Foundation\Http\FormRequest;
class Request extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'device_id' => 'required',
'device_token' => 'required',
'device_type' => 'required',
'device_name' => 'required',
];
}
}

View File

@@ -0,0 +1,218 @@
<?php
namespace App\Http\Requests\Api\Order;
use Illuminate\Foundation\Http\FormRequest;
class Request extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
if ($this->isMethod('get')) {
return [];
}
return [
'phone' => 'required|min:9|max:9',
'first_name' => 'required',
'type_delivery' => 'required',
// 'shipment_date' => 'nullable',
// 'city' => 'nullable',
// 'region' => 'nullable',
// 'street' => 'nullable',
// 'floor' => 'nullable',
// 'apartment' => 'nullable',
// 'entrance' => 'nullable',
'payment_type' => 'required',
'comment' => 'nullable',
// 'branch_id' => 'nullable',
'products' => 'array|required',
'products.*.id' => 'required',
'products.*.count' => 'required',
'products.*.size' => 'required',
'products.*.color_id' => 'required',
];
}
protected function getValidatorInstance() {
$validator = parent::getValidatorInstance();
if ($this->isMethod('post')) {
$validator->sometimes('branch_id', 'required', function($input) {
return $input->type_delivery == 2;
});
$validator->sometimes('shipment_date', 'required', function($input) {
return $input->type_delivery == 2;
});
$validator->sometimes('city', 'required', function($input) {
return $input->type_delivery == 1;
});
$validator->sometimes('region', 'required', function($input) {
return $input->type_delivery == 1;
});
$validator->sometimes('street', 'required', function($input) {
return $input->type_delivery == 1;
});
}
return $validator;
}
/**
* @return int
*/
public function getPhone(): int
{
return (int ) 998 . $this->get('phone');
}
/**
* @return string
*/
public function getFirstName(): string
{
return (string) $this->get('first_name');
}
/**
* @return mixed|null
*/
public function getBranchID()
{
if ($this->get('branch_id')) {
return $this->get('branch_id');
}
return null;
}
/**
* @return int
*/
public function getTypeDelivery(): int
{
return (int) $this->get('type_delivery');
}
/**
* @return mixed|null
*/
public function getShipmentDate()
{
if ($this->get('shipment_date')) {
return $this->get('shipment_date');
}
return null;
}
/**
* @return string|null
*/
public function getCity()
{
if ($this->get('city')) {
return (string) $this->get('city');
}
return null;
}
/**
* @return string|null
*/
public function getRegion()
{
if ($this->get('region')) {
return (string) $this->get('region');
}
return null;
}
/**
* @return string|null
*/
public function getStreet()
{
if ($this->get('street')) {
return (string) $this->get('street');
}
return null;
}
/**
* @return string|null
*/
public function getFloor()
{
if ($this->get('floor')) {
return (string) $this->get('floor');
}
return null;
}
/**
* @return string|null
*/
public function getApartment()
{
if ($this->get('apartment')) {
return (string) $this->get('apartment');
}
return null;
}
/**
* @return string|null
*/
public function getEntrance()
{
if ($this->get('entrance')) {
return (string) $this->get('entrance');
}
return null;
}
/**
* @return string
*/
public function getPaymentType()
{
return (string) $this->get('payment_type');
}
/**
* @return string
*/
public function getComment(): string
{
return (string) $this->get('comment');
}
/**
* @return mixed
*/
public function getProducts()
{
return $this->get('products');
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Http\Requests\Api\Partner;
use Illuminate\Foundation\Http\FormRequest;
class PartnerRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'partner_id' => 'required|exists:partners,id',
'phone' => 'required|numeric',
'full_name' => 'required',
'comment' => 'nullable',
'city_id' => 'required|exists:cities,id',
'price' => 'nullable',
];
}
}

View File

@@ -0,0 +1,36 @@
<?php
namespace App\Http\Requests\Api\Service;
use App\Models\Service;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class ServiceRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$service = Service::find($this->service_id);
return [
'service_id' => 'required|exists:services,id',
'power_id' => [
Rule::requiredIf(function () use ($service) {
// If service exists and is_power is true, require power_id
return $service && $service->is_power;
}),
'nullable', // Allow null if the condition is false
'exists:powers,id' // Validate the power_id exists in the powers table
],
'city_id' => 'required|exists:cities,id',
'phone' => 'required|numeric',
'full_name' => 'required',
'comment' => 'nullable',
];
}
}

View File

@@ -0,0 +1,98 @@
<?php
namespace App\Http\Requests\Api\User;
use Carbon\Carbon;
use Illuminate\Foundation\Http\FormRequest;
class Update extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'first_name' => 'required',
'last_name' => 'required',
'gender' => 'required',
'birth_day' => 'nullable',
'avatar' => 'nullable|mimes:jpeg,png,jpg',
'category' => 'required',
'language' => 'required',
'notification' => 'required'
];
}
/**
* @return string
*/
public function getFirstName(): string
{
return (string) $this->get('first_name');
}
/**
* @return string
*/
public function getLastName(): string
{
return (string) $this->get('last_name');
}
/**
* @return bool
*/
public function getGender(): bool
{
return $this->get('gender') == 'men' ? true : false;
}
/**
* @return string
*/
public function getBirthDay(): string
{
return (string) $this->get('birth_day');
}
/**
* @return false|string|null
*/
public function getAvatar()
{
if ($this->hasFile('avatar')) {
$path = "uploads/avatar/". Carbon::now()->format('Y/m/d');
return $this->file('avatar')->store($path);
}
return false;
}
/**
* @return int
*/
public function getCategory(): int
{
return (int) $this->get('category');
}
/**
* @return bool
*/
public function getNotification(): bool
{
return $this->get('notification');
}
/**
* @return string
*/
public function getLanguages(): string
{
return (string) $this->get('language');
}
}