37 lines
719 B
PHP
37 lines
719 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Practice extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'practitioner_role_id',
|
|
'service_code',
|
|
'active',
|
|
'created_by',
|
|
'updated_by',
|
|
'deleted_by'
|
|
];
|
|
|
|
public function getPricesGroupOneAttribute()
|
|
{
|
|
$orgPrices = [];
|
|
|
|
foreach ($this->prices->where('price_group_id', 1) as $price) {
|
|
$orgPrices[$this->service_code] = $price->price_net;
|
|
}
|
|
|
|
return $orgPrices;
|
|
}
|
|
|
|
public function prices()
|
|
{
|
|
return $this->morphMany(Price::class, 'priceable');
|
|
}
|
|
}
|