restore composer.json, add mysqli extension
This commit is contained in:
33
app/Http/Requests/Site/Cart/CartStoreRequest.php
Executable file
33
app/Http/Requests/Site/Cart/CartStoreRequest.php
Executable file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Site\Cart;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class CartStoreRequest extends FormRequest
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'product_id' => 'required|exists:products,id',
|
||||
'count' => 'required|numeric'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getSize()
|
||||
{
|
||||
if ($this->get('size')) {
|
||||
return $this->get('size');
|
||||
}
|
||||
|
||||
return $this->get('size');
|
||||
}
|
||||
}
|
||||
90
app/Http/Requests/Site/Checkout/StoreRequest.php
Executable file
90
app/Http/Requests/Site/Checkout/StoreRequest.php
Executable file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Site\Checkout;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreRequest extends FormRequest
|
||||
{
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
if ($this->isMethod('post')) {
|
||||
return [
|
||||
'delivery_type' => 'required',
|
||||
'payment_type' => 'required|in:cash,payme,apelsin,click,uzcard,humo',
|
||||
'products' => 'array|required',
|
||||
];
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
protected function getValidatorInstance() {
|
||||
$validator = parent::getValidatorInstance();
|
||||
|
||||
if ($this->isMethod('post')) {
|
||||
|
||||
$validator->sometimes('address.region_id', 'required', function($input) {
|
||||
return $input->delivery_type == 'delivery';
|
||||
});
|
||||
|
||||
$validator->sometimes('address.city_id', 'required', function($input) {
|
||||
return $input->delivery_type == 'delivery';
|
||||
});
|
||||
|
||||
$validator->sometimes('address.address', 'required', function($input) {
|
||||
return $input->delivery_type == 'delivery';
|
||||
});
|
||||
|
||||
$validator->sometimes('address.first_name', 'required', function($input) {
|
||||
return $input->delivery_type == 'delivery';
|
||||
});
|
||||
}
|
||||
|
||||
return $validator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getPaymentStatus()
|
||||
{
|
||||
if ($this->get('payment_type') === 'cash') {
|
||||
return 'cash';
|
||||
}
|
||||
|
||||
return 'waiting';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return mixed|null
|
||||
*/
|
||||
public function getShipmentDate()
|
||||
{
|
||||
if ($this->get('shipment_date')) {
|
||||
return $this->get('shipment_date');
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return mixed|null
|
||||
*/
|
||||
public function getBranchID()
|
||||
{
|
||||
if ($this->get('branch_id')) {
|
||||
return $this->get('branch_id');
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
23
app/Http/Requests/Site/Comment/CommentCreateRequest.php
Executable file
23
app/Http/Requests/Site/Comment/CommentCreateRequest.php
Executable file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Site\Comment;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class CommentCreateRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'first_name' => 'required|string',
|
||||
'body' => 'required|string',
|
||||
'star' => 'required|numeric',
|
||||
'product_id' => 'required|numeric|exists:products,id'
|
||||
];
|
||||
}
|
||||
}
|
||||
27
app/Http/Requests/Site/Feedback/Create.php
Executable file
27
app/Http/Requests/Site/Feedback/Create.php
Executable file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Site\Feedback;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class Create extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required|string',
|
||||
'phone' => [
|
||||
'required',
|
||||
'string',
|
||||
'regex:/(\+998) (90|91|92|93|94|95|96|97|98|99|33|88) [0-9]{3} [0-9]{2} [0-9]{2}/',
|
||||
],
|
||||
'message' => 'required|string'
|
||||
];
|
||||
}
|
||||
}
|
||||
37
app/Http/Requests/Site/Product/BuyOneClickRequest.php
Executable file
37
app/Http/Requests/Site/Product/BuyOneClickRequest.php
Executable file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Site\Product;
|
||||
|
||||
use App\Rules\Auth\Phone;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class BuyOneClickRequest 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 [
|
||||
'product_id' => 'required',
|
||||
'phone' => [
|
||||
'required',
|
||||
'string',
|
||||
'regex:/(998)(90|91|92|93|94|95|96|97|98|99)[0-9]{7}/',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
52
app/Http/Requests/Site/Product/CreditRequest.php
Executable file
52
app/Http/Requests/Site/Product/CreditRequest.php
Executable file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Site\Product;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class CreditRequest extends FormRequest
|
||||
{
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$this->merge([
|
||||
'phone' => str_replace(['+', '(', ')', '-', ' '], '', $this->phone),
|
||||
]);
|
||||
}
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
if ($this->isMethod('get')) {
|
||||
return [];
|
||||
}
|
||||
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'));
|
||||
}
|
||||
}
|
||||
26
app/Http/Requests/Site/Profile/ChangePasswordRequest.php
Executable file
26
app/Http/Requests/Site/Profile/ChangePasswordRequest.php
Executable file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Site\Profile;
|
||||
|
||||
|
||||
use App\Rules\MatchOldPassword;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ChangePasswordRequest extends FormRequest
|
||||
{
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'current_password' => ['required', new MatchOldPassword],
|
||||
'password' => 'required|confirmed|min:6'
|
||||
];
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
'password.confirmed' => trans('vue.login.confirmed'),
|
||||
'password.min' => trans('vue.login.min')
|
||||
];
|
||||
}
|
||||
}
|
||||
21
app/Http/Requests/Site/Profile/Update.php
Executable file
21
app/Http/Requests/Site/Profile/Update.php
Executable file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Site\Profile;
|
||||
|
||||
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'
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user