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

Revision

Revision 90 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
47 lars 1
<?php
2
 
48 lars 3
    namespace App\Http\Requests;
47 lars 4
 
48 lars 5
    use Illuminate\Foundation\Http\FormRequest;
47 lars 6
 
89 lars 7
    class ManufacturerRequest extends FormRequest
47 lars 8
    {
48 lars 9
        /**
10
         * Determine if the user is authorized to make this request.
11
         *
12
         * @return bool
13
         */
91 lars 14
        public function authorize(): bool
48 lars 15
        {
90 lars 16
            if ( isset( $GLOBALS["user_rechte"]["online_shop"]["hersteller"] ) )
48 lars 17
            {
18
                return true;
19
            }
47 lars 20
 
48 lars 21
            return false;
22
        }
23
 
24
        /**
25
         * Get the validation rules that apply to the request.
26
         *
27
         * @return array<string, mixed>
28
         */
91 lars 29
        public function rules(): array
48 lars 30
        {
31
            return [
89 lars 32
                "name"        => "required|max:255",
33
                "headline"    => "sometimes|max:255",
34
                "description" => "sometimes",
35
                "property_1"  => "sometimes|int|in:0,1",
36
                "property_2"  => "sometimes|int|in:0,1",
37
                "property_3"  => "sometimes|int|in:0,1",
38
                "calculation" => "sometimes|int|in:0,1",
48 lars 39
                //
40
            ];
41
        }
54 lars 42
 
91 lars 43
        protected function passedValidation(): void
54 lars 44
        {
89 lars 45
            if ( is_null( $this->description ) )
54 lars 46
            {
89 lars 47
                $this->description = "";
91 lars 48
            }
54 lars 49
        }
47 lars 50
    }