Add images to tasks
Everyone who may comment on a task sends images to it, e.g. photos taken with a phone. The server stores an upright, at most 2560 px JPEG without EXIF data (no location) and a 400 px thumbnail on the private disk, served only to those who see the job. Uploaders change captions (also the alt text) and remove their own images; admin and management may remove anyone's (jobs.remove-any-task-image). Removing a task also removes its image files. Livewire's temporary upload limit is raised to PHP's 40 MB so that the page's own 12 MB limit gives a translated message. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Jobs\Infrastructure\Persistence\Eloquent;
|
||||
|
||||
use Carbon\CarbonImmutable;
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Attributes\Table;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Persistence model of a task image, used only inside the Jobs
|
||||
* Infrastructure layer.
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $task_id
|
||||
* @property int|null $user_id
|
||||
* @property string $path
|
||||
* @property string $thumbnail_path
|
||||
* @property string $original_name
|
||||
* @property string|null $caption
|
||||
* @property int $width
|
||||
* @property int $height
|
||||
* @property CarbonImmutable $created_at
|
||||
*/
|
||||
#[Table('task_images')]
|
||||
#[Fillable(['task_id', 'user_id', 'path', 'thumbnail_path', 'original_name', 'caption', 'width', 'height', 'created_at'])]
|
||||
class TaskImageModel extends Model
|
||||
{
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'task_id' => 'integer',
|
||||
'user_id' => 'integer',
|
||||
'width' => 'integer',
|
||||
'height' => 'integer',
|
||||
'created_at' => 'immutable_datetime',
|
||||
'updated_at' => 'immutable_datetime',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user