Subversion-Projekte lars-tiefland.webanos.marine-sales.de

Revision

Revision 91 | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

<?php

    namespace App\Http\Requests;

    use Illuminate\Foundation\Http\FormRequest;

    class ManufacturerRequest extends FormRequest
    {
        /**
         * Determine if the user is authorized to make this request.
         *
         * @return bool
         */
        public function authorize(): bool
        {
            if ( isset( $GLOBALS["user_rechte"]["online_shop"]["hersteller"] ) )
            {
                return true;
            }

            return false;
        }

        /**
         * Get the validation rules that apply to the request.
         *
         * @return array<string, mixed>
         */
        public function rules(): array
        {
            return [
                "name"        => "required|max:255",
                "headline"    => "sometimes|max:255",
                "description" => "sometimes",
                "property_1"  => "sometimes|int|in:0,1",
                "property_2"  => "sometimes|int|in:0,1",
                "property_3"  => "sometimes|int|in:0,1",
                "calculation" => "sometimes|int|in:0,1",
                //
            ];
        }

        protected function passedValidation(): void
        {
            if ( is_null( $this->headline ) )
            {
                $this->headline = "";
            }
            if ( is_null( $this->description ) )
            {
                $this->description = "";
            }
        }
    }