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

Revision

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