Skip to content

Commit

Permalink
add models
Browse files Browse the repository at this point in the history
  • Loading branch information
alexPopaCode4 committed Sep 27, 2024
1 parent 58c0b7d commit 9ab7679
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
37 changes: 37 additions & 0 deletions app/Models/OrganizationService.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types=1);

namespace App\Models;

use App\Concerns\BelongsToOrganization;
use App\Enums\GeneralStatus;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;

class OrganizationService extends Model
{
use HasFactory;
use BelongsToOrganization;

protected $fillable = [
'service_id',
'status',
];

protected $casts = [
'status' => GeneralStatus::class,
];

public function service(): BelongsTo
{
return $this->belongsTo(Service::class);
}

public function interventions(): HasMany
{
return $this->hasMany(OrganizationServiceIntervention::class);
}
}
37 changes: 37 additions & 0 deletions app/Models/OrganizationServiceIntervention.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types=1);

namespace App\Models;

use App\Concerns\BelongsToOrganization;
use App\Enums\GeneralStatus;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class OrganizationServiceIntervention extends Model
{
use HasFactory;
use BelongsToOrganization;

protected $fillable = [
'service_intervention_id',
'organization_service_id',
'status',
];

protected $casts = [
'status' => GeneralStatus::class,
];

public function serviceIntervention(): BelongsTo
{
return $this->belongsTo(ServiceIntervention::class);
}

public function organizationService(): BelongsTo
{
return $this->belongsTo(OrganizationService::class);
}
}

0 comments on commit 9ab7679

Please sign in to comment.