added attchments
This commit is contained in:
46
app/Models/AttachmentGroup.php
Normal file
46
app/Models/AttachmentGroup.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property int|null $parent_id
|
||||
* @property int|null $position
|
||||
* @property int $max_size_kb
|
||||
* @property bool $is_active
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class AttachmentGroup extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'parent_id',
|
||||
'position',
|
||||
'max_size_kb',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'is_active' => 'bool',
|
||||
];
|
||||
|
||||
public function extensions(): HasMany
|
||||
{
|
||||
return $this->hasMany(AttachmentExtension::class, 'attachment_group_id');
|
||||
}
|
||||
|
||||
public function parent(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(self::class, 'parent_id');
|
||||
}
|
||||
|
||||
public function children(): HasMany
|
||||
{
|
||||
return $this->hasMany(self::class, 'parent_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user