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

Revision

Revision 151 | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
128 lars 1
<?php
2
 
161 lars 3
    namespace App\Http\Requests;
128 lars 4
 
161 lars 5
    use Illuminate\Foundation\Http\FormRequest;
128 lars 6
 
161 lars 7
    class UpdateSupplierRequest extends FormRequest
128 lars 8
    {
161 lars 9
        /**
10
         * Determine if the user is authorized to make this request.
11
         *
12
         * @return bool
13
         */
14
        public function authorize(): bool
151 lars 15
        {
161 lars 16
            if ( isset( $GLOBALS["user_rechte"]["bestellwesen"]["lieferanten"] ) )
17
            {
18
                return true;
19
            }
20
            return false;
151 lars 21
        }
128 lars 22
 
161 lars 23
        /**
24
         * Get the validation rules that apply to the request.
25
         *
26
         * @return array<string, mixed>
27
         */
28
        public function rules(): array
29
        {
30
            return [
31
                //
32
                "name"             => "required",
33
                "name2"            => "sometimes",
34
                "rank"             => "sometimes|integer",
35
                "contact"          => "sometimes",
36
                "street"           => "sometimes",
37
                "houseno"          => "sometimes",
38
                "zip"              => "sometimes",
39
                "city"             => "sometimes",
40
                "phone"            => "sometimes",
41
                "fax"              => "sometimes",
42
                "email"            => "sometimes|email",
43
                "customer_no"      => "sometimes",
44
                "shipping_hint"    => "sometimes",
45
                "payment_hint"     => "sometimes",
46
                "common"           => "sometimes",
47
                "script"           => "sometimes",
48
                "stock_script"     => "sometimes",
49
                "interval"         => "sometimes",
50
                "accounts_payable" => "sometimes",
51
                "ledger_account"   => "sometimes",
52
            ];
53
        }
54
 
55
        protected function passedValidation(): void
56
        {
57
            foreach ( $this as $key => $val )
58
            {
59
                if ( is_null( $val ) )
60
                {
61
                    if ( $key == "country_id" )
62
                    {
63
                        continue;
64
                    }
65
                    $this->$key = "";
66
                }
67
            }
68
        }
128 lars 69
    }