Subversion-Projekte lars-tiefland.laravel_shop

Revision

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

<?php

    namespace App\Http\Controllers;

    use Illuminate\Http\Request;
    use Illuminate\Database\Eloquent\Collection;

    class BasketItem extends Controller
    {
        public string     $name;
        public float      $price;
        public int        $menge;
        public string     $code = "";
        public int        $id;
        public Collection $medium;

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