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

Revision

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

Revision Autor Zeilennr. Zeile
2 lars 1
<?php
2
 
176 lars 3
    namespace App\Http\Controllers\online_shop;
2 lars 4
 
234 lars 5
    use App\Http\Controllers\Controller;
257 lars 6
    use App\Http\Requests\StoreSupplierShippingRequest;
2 lars 7
    use App\Models\Shipping;
250 lars 8
    use App\Models\ShippingGroup;
257 lars 9
    use Illuminate\Http\Request;
2 lars 10
    use Illuminate\Contracts\Foundation\Application;
11
    use Illuminate\Contracts\View\Factory;
12
    use Illuminate\Contracts\View\View;
13
 
14
    class ShippingController extends Controller
15
    {
16
 
249 lars 17
        public function __construct()
257 lars 18
        {
249 lars 19
            $inselversand = array(
20
                "keine Berücksichtigung",
21
                "kein Inselversand",
22
                "nur Inselversand",
257 lars 23
            );
249 lars 24
            \View::share( "inselversand", $inselversand );
25
            $shippingGroups = ShippingGroup::all();
26
            $versandgruppen = array();
257 lars 27
            foreach ( $shippingGroups as $shippingGroup )
249 lars 28
            {
29
                $versandgruppen[$shippingGroup->id] = $shippingGroup->name;
30
            }
31
            \View::share( "versandgruppen", $versandgruppen );
257 lars 32
        }
33
 
2 lars 34
        public function index(): Factory|View|Application
35
        {
257 lars 36
            $shipping = Shipping::with( "shipping_group" )->orderBy( "rank" )->get();
234 lars 37
            return View( "online_shop.shippingList", [ "shipping" => $shipping ] );
2 lars 38
        }
39
 
257 lars 40
        /**
41
         * Show the form for creating a new resource.
42
         *
43
         * @return Application|Factory|View
44
         */
45
        public function create(): View|Factory|Application
46
        {
47
            //
48
            return view( "online_shop.shipping" );
49
        }
50
 
51
        /**
52
         * Store a newly created resource in storage.
53
         *
54
         * @param StoreSupplierShippingRequest $request
55
         * @return void
56
         */
57
        public function store( Request $request ): void
58
        {
59
            //
60
            $data = $request->validated();
61
            Shipping::create( $data );
62
        }
63
 
64
        public function show( Shipping $shipping ): void
65
        {
66
            echo $shipping->name;
67
        }
68
 
69
        /**
70
         * Show the form for editing the specified resource.
71
         *
72
         * @param Shipping $shipping
73
         * @return Application|Factory|View
74
         */
75
        public function edit( Shipping $shipping ): View|Factory|Application
76
        {
77
            //
78
            $shipping->load( 'shipping_group' );
79
            return view( "online_shop.shipping", [ "vk" => $shipping, ] );
80
        }
81
 
82
        /**
83
         * Update the specified resource in storage.
84
         *
85
         * @param Request $request
86
         * @param Shipping $shipping
87
         * @return void
88
         */
89
        public function update( Request $request, Shipping $shipping ): void
90
        {
91
            //
92
            $data = $request->validated();
93
            $shipping->update( $data );
94
        }
95
 
96
        /**
97
         * Remove the specified resource from storage.
98
         *
99
         * @param Shipping $shipping
100
         * @return void
101
         */
102
        public function destroy( Shipping $shipping ): void
103
        {
104
            //
105
            $shipping->delete();
106
        }
2 lars 107
    }