Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 1431 | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
2 lars 1
<?php
2
 
1337 lars 3
    namespace App\Models;
2 lars 4
 
1337 lars 5
    use Illuminate\Database\Eloquent\Factories\HasFactory;
6
    use Illuminate\Database\Eloquent\Model;
1341 lars 7
    use Illuminate\Database\Eloquent\Relations\BelongsTo;
1430 lars 8
    use Illuminate\Database\Eloquent\Relations\BelongsToMany;
1337 lars 9
    use Illuminate\Database\Eloquent\Relations\HasMany;
10
    use Illuminate\Database\Eloquent\Relations\HasOne;
2 lars 11
 
1337 lars 12
    class Order extends Model
13
    {
14
        use HasFactory;
15
 
16
        /**
17
         * The connection name for the model.
18
         *
19
         * @var string
20
         */
21
        protected $connection = 'order';
22
 
23
        public function orderItem(): HasMany
24
        {
25
            return $this->hasMany( OrderItem::class )->orderBy( 'rank' );
26
        }
27
 
1341 lars 28
        public function orderType(): BelongsTo
1337 lars 29
        {
1341 lars 30
            return $this->belongsTo( OrderType::class );
1337 lars 31
 
32
        }
33
 
1342 lars 34
        public function billAddr(): BelongsTo
1337 lars 35
        {
1342 lars 36
            return $this->belongsTo( OrderAddress::class, 'bill_addr_id' );
1337 lars 37
        }
1350 lars 38
        public function shop(): BelongsTo
39
        {
40
            return $this->belongsTo( Shop::class );
41
        }
1337 lars 42
 
1342 lars 43
        public function shipAddr(): BelongsTo
1337 lars 44
        {
1342 lars 45
            return $this->belongsTo( OrderAddress::class, 'ship_addr_id' );
1337 lars 46
        }
47
    }