Basic implementation of payment methods
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Scopes\InstancedModel;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string $tenant
|
||||
* @property string $slug
|
||||
* @property string $name
|
||||
* @property ?string $description
|
||||
* @property bool $active
|
||||
*/
|
||||
class AvailablePaymentMethod extends InstancedModel
|
||||
{
|
||||
protected $table = 'available_payment_methods';
|
||||
|
||||
protected $fillable = [
|
||||
'tenant',
|
||||
'slug',
|
||||
'name',
|
||||
'description',
|
||||
'active',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'active' => 'boolean',
|
||||
];
|
||||
|
||||
public function paymentMethod(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(PaymentMethod::class, 'slug', 'slug');
|
||||
}
|
||||
|
||||
public function events(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Event::class, 'event_payment_methods')->withTimestamps();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user