Reorder operation with image #654
-
Hello, I need a user to be able to drag and drop crud items with an image as a label. Here is my code: protected function setupReorderOperation()
Unfortunately, that just displays the name of the image which is super cryptic. I was hoping for the image itself, which is stored on s3. The field contains just the file name. Is there a way to specify that it's an image or worst case, inject the image tag around the label with the s3 bucket path? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hey @ericjanofski You need to
use Illuminate\Database\Eloquent\Casts\Attribute;
public function imageThumb(): Attribute
{
return Attribute::make(
get: fn () => ("<img id='$this->id' src='https://picsum.photos/id/$this->id/50' /> $this->label"),
);
}
|
Beta Was this translation helpful? Give feedback.
-
Thank you very much, great solution! |
Beta Was this translation helpful? Give feedback.
Hey @ericjanofski
You need to
CRUD::set('reorder.label', 'imageThumb');