mastercut/app/Models/Barbershop.php

77 lines
1.5 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\MorphOne;
use Illuminate\Database\Eloquent\SoftDeletes;
class Barbershop extends Model
{
use HasFactory, SoftDeletes;
protected $table = 'barbershop';
protected $fillable = [
'name',
'contact_number',
'landmark',
'address',
'opened',
'closed',
'cash',
];
public function users(): HasMany
{
return $this->hasMany(User::class);
}
public function customers(): HasMany
{
return $this->hasMany(Customer::class);
}
public function services(): HasMany
{
return $this->hasMany(Service::class);
}
public function attendances(): HasMany
{
return $this->hasMany(Attendance::class);
}
public function expenses(): HasMany
{
return $this->hasMany(Expense::class);
}
public function inventory(): HasMany
{
return $this->hasMany(Inventory::class);
}
public function transactions(): HasMany
{
return $this->hasMany(Transaction::class);
}
public function payrolls(): HasMany
{
return $this->hasMany(Payroll::class);
}
public function cash(): HasMany
{
return $this->hasMany(Cash::class);
}
public function attachment(): MorphOne
{
return $this->morphOne(Attachment::class, 'attachmentable');
}
}