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

Revision

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

<?php

    namespace App\Http\Requests;

    use Illuminate\Foundation\Http\FormRequest;

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

            return false;
        }

        /**
         * Get the validation rules that apply to the request.
         *
         * @return array<string, mixed>
         */
        public function rules()
        {
            return [
                "only_deliverable" => "required|int|in:0,1",
                "status"           => "required|int|in:0,1",
                "min_price"        => "decimal:0,2",
                "contact_name"     => "sometimes|max:255",
                "contact_email"    => "sometimes|max:255",
                "contact_phone"    => "sometimes|max:255",
                "access_url"       => "sometimes|max:255",
                "access_user"      => "sometimes||max:255",
                "access_password"  => "sometimes|max:255",
                "comment"          => "sometimes",
                "comment2"         => "sometimes",
                //
            ];
        }

        protected function passedValidation()
        {
            if ( is_null( $this->access_url ) )
            {
                $this->access_url = "";
            }
            if ( is_null( $this->access_user ) )
            {
                $this->access_user = "";
            }
            if ( is_null( $this->access_password ) )
            {
                $this->access_password = "";
            }
        }
    }