1
0
forked from poc/pds

updated models

This commit is contained in:
IOT Dev
2025-03-19 18:11:00 +05:30
parent 7be3c46a5e
commit 04ee0cadd5
38 changed files with 2769 additions and 2 deletions

21
app/Models/Company.php Normal file
View File

@@ -0,0 +1,21 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
class Company extends Model
{
use SoftDeletes;
protected $fillable = [
'name',
];
public function plants(): HasMany
{
return $this->hasMany(Plant::class);
}
}

24
app/Models/Plant.php Normal file
View File

@@ -0,0 +1,24 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class Plant extends Model
{
use SoftDeletes;
protected $fillable = [
'code',
'company_id',
'name',
'address',
];
public function company(): BelongsTo
{
return $this->belongsTo(Company::class);
}
}