Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel request unique

<?php

namespace AppRequestsAdminProduct;

use AppRequestsBaseRequest;

class UpdateProductRequest extends BaseRequest
{
    public function rules()
    {
        //        dd();

        return [
            "title"            => "required|array",
            "title.*"          => "required|string",
            "content"          => "required|array",
            "content.*"        => "required|string",
            "meta_title"       => "required|array",
            "meta_title.*"     => "required|string",
            "meta_description" => "required|array",
            //            "meta_description.*" => "required|string",
            "meta_keyword"     => "required|array",
            "slug"             => "nullable|array",
            "slug.*"           => "required|string",
            //            "meta_keyword.*" => "required|string",
            "model"            => "required|string",
            "sku"              => "required|string|unique:products,sku,".$this->id,
            //            "price"            => "required|numeric|min:0",
            "quantity"         => "required|numeric|min:0",
            "min_quantity"     => "required|numeric|min:0",
            "warehouse"        => "required|boolean",
            "length"           => "required|string",
            "width"            => "required|string",
            "height"           => "required|string",
            "length_type"      => "required|integer|exists:length_classes,id",
            "weight"           => "required|string",
            "weight_type"      => "required|integer|exists:weight_classes,id",
            "status"           => "required|boolean",
            "sort_product"     => "required|integer|min:0",

            "manufacturer"  => "required|integer|exists:manufacturers,id",
            "category"      => "required|array",
            "category.*.id" => "required|integer|exists:category,id",
            //            "suppliers"     => "required|integer|exists:suppliers,id",

            "product_filter"      => "required|array",
            "product_filter.*.id" => "required|integer|exists:filter_values,id",

            "product_attribute"                => "array|nullable",
            "product_attribute.*.attribute_id" => "required|integer|exists:attributes,id",
            "product_attribute.*.text"         => "required|array",
            "product_attribute.*.text.*"       => "required|string",

            "product_option"             => "array|nullable",
            "product_option.*.required"  => "required|boolean",
            "product_option.*.option_id" => "required|integer|exists:options,id",

            "product_option.*.product_option_value"                   => "array|nullable",
            "product_option.*.product_option_value.*.option_value_id" => "required|integer|exists:option_values,id",
            "product_option.*.product_option_value.*.quantity"        => "required|integer|min:0",
            "product_option.*.product_option_value.*.subtract"        => "required|boolean",
            "product_option.*.product_option_value.*.price"           => "nullable|numeric|min:0",
            "product_option.*.product_option_value.*.price_prefix"    => "nullable|string|max:1",
            "product_option.*.product_option_value.*.points"          => "nullable|integer|min:0",
            "product_option.*.product_option_value.*.points_prefix"   => "nullable|string|max:1",
            "product_option.*.product_option_value.*.weight"          => "nullable|numeric|min:0",
            "product_option.*.product_option_value.*.weight_prefix"   => "nullable|string|max:1",

            "product_discount"              => "array|nullable",
            "product_discount.*.quantity"   => "required|numeric|min:1",
            "product_discount.*.priority"   => "required|string",
            "product_discount.*.price"      => "required|numeric|min:0",
            "product_discount.*.date_start" => "required|date",
            "product_discount.*.date_end"   => "required|date",

            "product_special"              => "array|nullable",
            "product_special.*.priority"   => "required|string",
            "product_special.*.price"      => "required|numeric|min:0",
            "product_special.*.date_start" => "required|date",
            "product_special.*.date_end"   => "required|date",

            "images"         => "array|required",
            "images.*.image" => "required|string",

            "product_price"               => "array|nullable",
            "product_price.*.supplier_id" => "required|numeric",
            "product_price.*.price"       => "required|string",

        ];
    }
}
Comment

PREVIOUS NEXT
Code Example
Php :: php number format without rounding 
Php :: luhn algorithm credit card checker php 
Php :: add top menu bar in wordpress 
Php :: php call constant in class 
Php :: php add custom button in wordpress editor 
Php :: php apply function to array elements 
Php :: get specific word from string php 
Php :: laravel 8 add column to existing table 
Php :: create laravel 8 resource route 
Php :: if user name is wordpress 
Php :: error 500 internal server error in laravel 
Php :: laravel observer get old value 
Php :: php difference between two dates in seconds 
Php :: change default user table name laravel 
Php :: how to add column to database in laravel 
Php :: find value in array php 
Php :: rewrite url to exclude php extension 
Php :: violation: 1071 Specified key was too long; max key length is 1000 bytes 
Php :: display error meaages in laravel blade 
Php :: php dom get element innerhtml 
Php :: php wpdb foreach 
Php :: set_magic_quotes_runtime php 7 
Php :: laravel invoice toturial 
Php :: switch between php version ubuntu 
Php :: php access key stdClass object 
Php :: laravel 8 carbon if date is today 
Php :: laravel import csv to database 
Php :: fillable vs guarded laravel 
Php :: wp-config for production 
Php :: laravel eloquent get all where in 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =