refactor(backend): reorganize domains into Core, Commerce, Ticketing and Shared
This commit is contained in:
43
app/Shared/Attachable/Models/AttachmentCrop.php
Normal file
43
app/Shared/Attachable/Models/AttachmentCrop.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Attachable\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
#[Fillable([
|
||||
'attachment_id',
|
||||
'variant',
|
||||
'crop_horizontal',
|
||||
'crop_vertical',
|
||||
'cropped_attachment_id',
|
||||
])]
|
||||
class AttachmentCrop extends Model
|
||||
{
|
||||
public const DESKTOP = 'desktop';
|
||||
|
||||
public const MOBILE = 'mobile';
|
||||
|
||||
public const VARIANTS = [self::DESKTOP, self::MOBILE];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'attachment_id' => 'integer',
|
||||
'crop_horizontal' => 'array',
|
||||
'crop_vertical' => 'array',
|
||||
'cropped_attachment_id' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
public function attachment(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Attachment::class);
|
||||
}
|
||||
|
||||
public function croppedAttachment(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Attachment::class, 'cropped_attachment_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user