<?php

namespace App\Models;

use App\Models\Client\Client;
use App\Trait\BelongsToSolicitor;
use App\Trait\HasSlug;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Tranche extends Model {
    use HasFactory, SoftDeletes, HasSlug, BelongsToSolicitor;

    protected $fillable = [
        'solicitor_id',
        'funder_name',
        'tranche_name',
        'amount_per_case',
        'description',
        'funded_date'
    ];

    public $casts = [
        'funded_date' => 'datetime',
    ];

    public function clients() {
        return $this->hasMany(Client::class);
    }
}
