Current File : //home/tradevaly/text.tradevaly.com.bd/app/Models/BuyOffer.php
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
class BuyOffer extends Model
{
    use HasFactory;
   
   public function category(){
        return $this->belongsTo(Category::class);
    }
   
   
    public function buyer(){
        return $this->belongsTo(Company::class, 'buyer_id', 'user_id');
    }
    public function user(){
        return $this->belongsTo(User::class, 'buyer_id', 'id');
    }
    public function country(){
        return $this->belongsTo(Country::class);
    }
    public function product(){
        return $this->belongsTo(Product::class);
    }
  
    protected static function boot() {
        parent::boot();

        static::creating(function ($question) {
            $question->slug = Str::slug($question->title);
        });
    }
}