36 lines
775 B
PHP
36 lines
775 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
|
|
class Currency extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'currencies';
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var list<string>
|
|
*/
|
|
protected $fillable = [
|
|
'code',
|
|
];
|
|
|
|
/**
|
|
* Get the account records that have the currency.
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany<\App\Models\Account, $this>
|
|
*/
|
|
public function accounts(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(Account::class)
|
|
->withPivot('active')
|
|
->withTimestamps();
|
|
}
|
|
}
|