Files
Paymenter-Version-Tracks/app/Models/Extension.php
Muhammad Tamir 85c03cef82 v1.3.4
2025-11-14 10:57:49 +07:00

45 lines
1.0 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use OwenIt\Auditing\Contracts\Auditable;
class Extension extends Model implements Auditable
{
use \App\Models\Traits\Auditable, HasFactory;
protected $fillable = [
'name',
'enabled',
// Name of extension class (e.g. 'Stripe' or 'Paypal')
'extension',
'type',
];
protected $guarded = [];
/**
* Get the extension's settings.
*/
public function settings()
{
return $this->morphMany(Setting::class, 'settingable');
}
public function path(): Attribute
{
return Attribute::make(
get: fn () => ucfirst($this->type) . 's/' . ucfirst($this->extension)
);
}
public function namespace(): Attribute
{
return Attribute::make(
get: fn () => 'Paymenter\\Extensions\\' . ucfirst($this->type) . 's\\' . ucfirst($this->extension)
);
}
}