Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 744 | Zur aktuellen Revision | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

<?php

    namespace App\Http\Controllers;

    use App\Models\Item;
    use Illuminate\Database\Eloquent\Collection;

    class BasketItemController extends Controller
    {
        public string     $name;
        public float      $price;
        public int        $menge;
        public string     $code = "";
        public int        $id;
        public Collection $medium;
        public ?int       $tax  = 0;
        public string     $slug = "";
        public int        $spedId = 0;
        public int        $versandgruppen_id = 1;
        public float      $gewicht = 0;

        //
        public string $addinfo;

        public function __construct( int $menge, float $price, int $item, string $code = "" )
        {
            if ( $menge >= 1 )
            {
                $dbItem = Item::with( 'medium.medium', 'price' )->find( $item );
                $this->medium = $dbItem->medium;
                $this->menge = $menge;
                $this->slug = $dbItem->slug;
                $this->price = $dbItem->price[0]->preis;
                if ( $price )
                {
                    $this->price = $price;
                }
                $this->name = $dbItem->name;
                //$this->tax = $dbItem->tax1;
                $this->id = $item;
            }
        }
    }