<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Order extends Model
{
    protected $fillable = [
        'network_id',
        'bundle_id',
        'recipient_phone',
        'cost',
        'price',
        'profit',
        'status',
        'user_id',
        'is_customer',
        'payment_mode',
        'payment_status',
    ];

    // Relationships
    public function network()
    {
        return $this->belongsTo(Network::class);
    }

    public function bundle()
    {
        return $this->belongsTo(Bundle::class);
    }

    public function api()
    {
        return $this->hasOne(ApiOrders::class);
    }

    public function user()
    {
        return $this->belongsTo(User::class, 'user_id', 'id');
    }

    public function payment()
    {
        return $this->hasOne(OrderPayment::class);
    }

    public function systemLevy()
    {
        return $this->hasOne(SLInflow::class);
    }
}