Done the validation from laravel validation
This commit is contained in:
parent
d83f49f504
commit
4efc70496f
|
|
@ -1613,7 +1613,6 @@ return [
|
|||
'set-order-status' => 'قم بتعيين حالة الطلب بعد إنشاء الفاتورة إلى',
|
||||
'generate-invoice-applicable' => 'قابل للتطبيق إذا تم تمكين إنشاء الفاتورة تلقائيًا',
|
||||
'records-found' => 'تم العثور على السجلات ',
|
||||
'image-required' => 'Image is required'
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -1631,7 +1631,6 @@ return [
|
|||
'logo-size' => 'Image resolution should be like 112px X 41px',
|
||||
'favicon-size' => 'Image resolution should be like 16px X 16px',
|
||||
'invoice-logo-size' => 'Image resolution should be like 192px X 50px',
|
||||
'image-required' => 'Image is required'
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -1589,7 +1589,6 @@ return [
|
|||
'set-order-status' => 'Set the order status after creating the invoice to',
|
||||
'generate-invoice-applicable' => 'Applicable if automatic generate invoice is enabled',
|
||||
'records-found' => 'Datensätze gefunden ',
|
||||
'image-required' => 'Image is required'
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -1631,7 +1631,6 @@ return [
|
|||
'logo-size' => 'Image resolution should be like 112px X 41px',
|
||||
'favicon-size' => 'Image resolution should be like 16px X 16px',
|
||||
'invoice-logo-size' => 'Image resolution should be like 192px X 50px',
|
||||
'image-required' => 'Image is required'
|
||||
|
||||
],
|
||||
],
|
||||
|
|
|
|||
|
|
@ -1611,7 +1611,6 @@ return [
|
|||
'set-order-status' => 'Set the order status after creating the invoice to',
|
||||
'generate-invoice-applicable' => 'Applicable if automatic generate invoice is enabled',
|
||||
'records-found' => 'registros encontrados',
|
||||
'image-required' => 'Image is required'
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -1590,7 +1590,6 @@ return [
|
|||
'set-order-status' => 'Set the order status after creating the invoice to',
|
||||
'generate-invoice-applicable' => 'Applicable if automatic generate invoice is enabled',
|
||||
'records-found' => 'Record(s) found',
|
||||
'image-required' => 'Image is required'
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -1627,7 +1627,6 @@ return [
|
|||
'set-order-status' => 'Définissez le statut de la commande après la création de la facture sur',
|
||||
'generate-invoice-applicable' => 'Applicable si la génération automatique de facture est activée',
|
||||
'records-found' => 'enregistrements trouvés',
|
||||
'image-required' => 'Image is required'
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -1631,7 +1631,6 @@ return [
|
|||
'logo-size' => 'Image resolution should be like 112px X 41px',
|
||||
'favicon-size' => 'Image resolution should be like 16px X 16px',
|
||||
'invoice-logo-size' => 'Image resolution should be like 192px X 50px',
|
||||
'image-required' => 'Image is required'
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -1628,7 +1628,6 @@ return [
|
|||
'logo-size' => 'छवि संकल्प 112px X 41px जैसा होना चाहिए',
|
||||
'favicon-size' => 'छवि संकल्प 16px X 16px जैसा होना चाहिए',
|
||||
'invoice-logo-size' => 'इमेज रेजोल्यूशन 192px X 50px जैसा होना चाहिए',
|
||||
'image-required' => 'Image is required'
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -1598,7 +1598,6 @@ return [
|
|||
'set-order-status' => 'Set the order status after creating the invoice to',
|
||||
'generate-invoice-applicable' => 'Applicabile se la generazione automatica di fatture é abilitata',
|
||||
'records-found' => 'Record(s) trovati',
|
||||
'image-required' => 'Image is required'
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -1631,7 +1631,6 @@ return [
|
|||
'logo-size' => 'Image resolution should be like 112px X 41px',
|
||||
'favicon-size' => 'Image resolution should be like 16px X 16px',
|
||||
'invoice-logo-size' => 'Image resolution should be like 192px X 50px',
|
||||
'image-required' => 'Image is required'
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -1590,7 +1590,6 @@ return [
|
|||
'set-order-status' => 'Set the order status after creating the invoice to',
|
||||
'generate-invoice-applicable' => 'Applicable if automatic generate invoice is enabled',
|
||||
'records-found' => 'Record(s) found',
|
||||
'image-required' => 'Image is required'
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -1579,7 +1579,6 @@ return [
|
|||
'set-order-status' => 'Set the order status after creating the invoice to',
|
||||
'generate-invoice-applicable' => 'Applicable if automatic generate invoice is enabled',
|
||||
'records-found' => 'Record(s) found',
|
||||
'image-required' => 'Image is required'
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -1593,7 +1593,6 @@ return [
|
|||
'set-order-status' => 'Set the order status after creating the invoice to',
|
||||
'generate-invoice-applicable' => 'Applicable if automatic generate invoice is enabled',
|
||||
'records-found' => 'Record(s) found',
|
||||
'image-required' => 'Image is required'
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -1631,7 +1631,6 @@ return [
|
|||
'logo-size' => 'Image resolution should be like 112px X 41px',
|
||||
'favicon-size' => 'Image resolution should be like 16px X 16px',
|
||||
'invoice-logo-size' => 'Image resolution should be like 192px X 50px',
|
||||
'image-required' => 'Image is required'
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -1631,7 +1631,6 @@ return [
|
|||
'logo-size' => 'Image resolution should be like 112px X 41px',
|
||||
'favicon-size' => 'Image resolution should be like 16px X 16px',
|
||||
'invoice-logo-size' => 'Image resolution should be like 192px X 50px',
|
||||
'image-required' => 'Image is required'
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -1588,7 +1588,6 @@ return [
|
|||
'set-order-status' => 'Faturayı oluşturduktan sonra sipariş durumunu ayarlayın.',
|
||||
'generate-invoice-applicable' => 'Otomatik fatura oluştur etkinse geçerlidir',
|
||||
'records-found' => 'Kayıt(lar) bulundu',
|
||||
'image-required' => 'Image is required'
|
||||
|
||||
],
|
||||
],
|
||||
|
|
|
|||
|
|
@ -1586,7 +1586,6 @@ return [
|
|||
'logo-size' => '图像分辨率应该是 112px X 41px',
|
||||
'favicon-size' => '图像分辨率应该是 16px X 16px',
|
||||
'invoice-logo-size' => '图像分辨率应该是 192px X 50px',
|
||||
'image-required' => 'Image is required'
|
||||
],
|
||||
],
|
||||
'api' => [
|
||||
|
|
|
|||
|
|
@ -155,17 +155,6 @@ class ProductController extends Controller
|
|||
*/
|
||||
public function update(ProductForm $request, $id)
|
||||
{
|
||||
foreach (request()->images['files'] as $fileExists) {
|
||||
|
||||
if (! $fileExists) {
|
||||
session()->flash('error', trans('admin::app.admin.system.image-required'));
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
|
||||
$this->productRepository->update(request()->all(), $id);
|
||||
|
||||
Event::dispatch('catalog.product.update.before', $id);
|
||||
|
||||
$product = $this->productRepository->update(request()->all(), $id);
|
||||
|
|
|
|||
|
|
@ -2,13 +2,14 @@
|
|||
|
||||
namespace Webkul\Product\Http\Requests;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Webkul\Admin\Validations\ProductCategoryUniqueSlug;
|
||||
use Webkul\Core\Contracts\Validations\Decimal;
|
||||
use Webkul\Core\Contracts\Validations\Slug;
|
||||
use Webkul\Core\Contracts\Validations\Decimal;
|
||||
use Webkul\Product\Models\ProductAttributeValue;
|
||||
use Webkul\Product\Repositories\ProductAttributeValueRepository;
|
||||
use Webkul\Product\Repositories\ProductRepository;
|
||||
use Webkul\Admin\Validations\ProductCategoryUniqueSlug;
|
||||
use Webkul\Product\Repositories\ProductAttributeValueRepository;
|
||||
|
||||
class ProductForm extends FormRequest
|
||||
{
|
||||
|
|
@ -66,6 +67,14 @@ class ProductForm extends FormRequest
|
|||
'special_price' => ['nullable', new Decimal, 'lt:price'],
|
||||
]);
|
||||
|
||||
foreach (request()->images['files'] as $key => $file) {
|
||||
if (Str::contains($key, 'image_')) {
|
||||
$this->rules = array_merge($this->rules, [
|
||||
'images.files.' . $key => ['required', 'mimes:bmp,jpeg,jpg,png,webp'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($product->getEditableAttributes() as $attribute) {
|
||||
if (
|
||||
in_array($attribute->code, ['sku', 'url_key'])
|
||||
|
|
|
|||
Loading…
Reference in New Issue