Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 1337 | Revision 1342 | Zur aktuellen Revision | 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;
1337 lars 8
    use Illuminate\Database\Eloquent\Relations\HasMany;
9
    use Illuminate\Database\Eloquent\Relations\HasOne;
2 lars 10
 
1337 lars 11
    class Order extends Model
12
    {
13
        use HasFactory;
14
 
15
        /**
16
         * The connection name for the model.
17
         *
18
         * @var string
19
         */
20
        protected $connection = 'order';
21
 
22
        public function orderItem(): HasMany
23
        {
24
            return $this->hasMany( OrderItem::class )->orderBy( 'rank' );
25
        }
26
 
1341 lars 27
        public function orderType(): BelongsTo
1337 lars 28
        {
1341 lars 29
            return $this->belongsTo( OrderType::class );
1337 lars 30
 
31
        }
32
 
33
        public function billAddr(): HasOne
34
        {
35
            return $this->hasOne( OrderAddress::class, 'bill_addr_id' );
36
        }
37
 
38
        public function shipAddr(): HasOne
39
        {
40
            return $this->hasOne( OrderAddress::class, 'ship_addr_id' );
41
        }
42
    }