Initial Commit
This commit is contained in:
25
app/Models/Domains.php
Normal file
25
app/Models/Domains.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Domains extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public function records(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->hasMany(Records::class);
|
||||
}
|
||||
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::deleting(function ($domain) {
|
||||
$domain->records()->delete();
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user