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

Revision

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

Revision Autor Zeilennr. Zeile
2 lars 1
<?php
2
 
84 lars 3
    namespace App\Http\Controllers;
2 lars 4
 
88 lars 5
    use App\Http\Requests\ManufacturerRequest;
84 lars 6
    use App\Models\Manufacturer;
102 lars 7
    use Illuminate\Contracts\Foundation\Application;
8
    use Illuminate\Contracts\View\Factory;
9
    use Illuminate\Contracts\View\View;
2 lars 10
 
84 lars 11
    class ManufacturerController extends Controller
12
    {
13
        //
14
 
102 lars 15
        public function index(): Factory|View|Application
84 lars 16
        {
17
            $manufacturers = Manufacturer::all();
18
            return view( "online_shop.manufacturerList", [ "manufacturers" => $manufacturers ] );
19
        }
88 lars 20
 
102 lars 21
        public function create(): Factory|View|Application
88 lars 22
        {
102 lars 23
            return View( 'online_shop.manufacturer' );
24
        }
25
 
26
        public function edit( Manufacturer $manufacturer ): Factory|View|Application
27
        {
88 lars 28
            return View( 'online_shop.manufacturer', [ "zeile" => $manufacturer ] );
29
        }
30
 
117 lars 31
        public function show( Manufacturer $manufacturer )
115 lars 32
        {
33
            echo $manufacturer->name;
34
        }
35
 
104 lars 36
        public function store( ManufacturerRequest $request ): void
88 lars 37
        {
38
            $data = $request->validated();
112 lars 39
            Manufacturer::create( $data );
102 lars 40
        }
41
 
42
        public function update( ManufacturerRequest $request, Manufacturer $manufacturer ): void
43
        {
44
            $data = $request->validated();
88 lars 45
            $manufacturer->update( $data );
46
        }
120 lars 47
 
121 lars 48
        public function destroy( Manufacturer $manufacturer ): void
120 lars 49
        {
50
            $manufacturer->delete();
51
        }
84 lars 52
    }