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

Revision

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

Revision Autor Zeilennr. Zeile
128 lars 1
<?php
2
 
176 lars 3
    namespace App\Http\Controllers\bestellwesen;
128 lars 4
 
176 lars 5
    use App\Http\Controllers\Controller;
131 lars 6
    use App\Http\Requests\StoreSupplierRequest;
7
    use App\Http\Requests\UpdateSupplierRequest;
8
    use App\Models\Supplier;
134 lars 9
    use Illuminate\Contracts\Foundation\Application;
10
    use Illuminate\Contracts\View\Factory;
220 lars 11
    use Illuminate\Contracts\View\View;
185 lars 12
    use Illuminate\Support\Facades\Schema;
220 lars 13
 
131 lars 14
    class SupplierController extends Controller
128 lars 15
    {
185 lars 16
 
17
        public function __construct()
18
        {
19
            $vk = false;
187 lars 20
            if ( Schema::hasColumn( 'shippings', 'supplier_id' ) )
185 lars 21
            {
22
                $vk = true;
23
            }
221 lars 24
            \View::share( 'vk', $vk );
185 lars 25
        }
187 lars 26
 
131 lars 27
        /**
28
         * Display a listing of the resource.
29
         *
134 lars 30
         * @return Application|Factory|View
131 lars 31
         */
134 lars 32
        public function index(): View|Factory|Application
131 lars 33
        {
34
            //
135 lars 35
            return view( "bestellwesen.supplierList", [ "lieferanten" => Supplier::all() ] );
131 lars 36
        }
128 lars 37
 
131 lars 38
        /**
39
         * Show the form for creating a new resource.
40
         *
135 lars 41
         * @return Application|Factory|View
131 lars 42
         */
135 lars 43
        public function create(): View|Factory|Application
131 lars 44
        {
45
            //
135 lars 46
            return view( "bestellwesen.supplier" );
131 lars 47
        }
128 lars 48
 
131 lars 49
        /**
50
         * Store a newly created resource in storage.
51
         *
52
         * @param StoreSupplierRequest $request
318 lars 53
         * @return string
131 lars 54
         */
318 lars 55
        public function store( StoreSupplierRequest $request ): string
131 lars 56
        {
57
            //
136 lars 58
            $data = $request->validated();
59
            Supplier::create( $data );
318 lars 60
            return "{}";
131 lars 61
        }
128 lars 62
 
131 lars 63
        /**
64
         * Display the specified resource.
65
         *
66
         * @param Supplier $supplier
136 lars 67
         * @return void
131 lars 68
         */
222 lars 69
        public function show( Supplier $supplier ): void
131 lars 70
        {
71
            //
147 lars 72
            echo $supplier->name;
131 lars 73
        }
128 lars 74
 
131 lars 75
        /**
76
         * Show the form for editing the specified resource.
77
         *
78
         * @param Supplier $supplier
135 lars 79
         * @return Application|Factory|View
131 lars 80
         */
135 lars 81
        public function edit( Supplier $supplier ): View|Factory|Application
131 lars 82
        {
83
            //
140 lars 84
            return view( "bestellwesen.supplier", [ "lieferant" => $supplier ] );
131 lars 85
        }
128 lars 86
 
131 lars 87
        /**
88
         * Update the specified resource in storage.
89
         *
90
         * @param UpdateSupplierRequest $request
91
         * @param Supplier $supplier
318 lars 92
         * @return string
131 lars 93
         */
318 lars 94
        public function update( UpdateSupplierRequest $request, Supplier $supplier ): string
131 lars 95
        {
96
            //
136 lars 97
            $data = $request->validated();
98
            $supplier->update( $data );
318 lars 99
            return "{}";
131 lars 100
        }
128 lars 101
 
131 lars 102
        /**
103
         * Remove the specified resource from storage.
104
         *
105
         * @param Supplier $supplier
318 lars 106
         * @return string
131 lars 107
         */
318 lars 108
        public function destroy( Supplier $supplier ): string
131 lars 109
        {
110
            //
142 lars 111
            $supplier->delete();
318 lars 112
            return "{}";
131 lars 113
        }
128 lars 114
    }