You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Couldn't figure out how to get the old value of a custom attachment from certain model ,
i added the Attachable trait , and the attachments is working and i can get the default old values using Upload::value("attachment")
but i added a foreign key in my post model to set a default image ( featured image ) us the Cropper field but i can't preview it , apparently the Cropper::value() accepts the attachment url , and i couldn't link it to a relationship ( hasOne ) .
this is how i did resolve but it seems like a bad workaround :
PostResource
private $post;
public function __construct(Request $request)
{
$this->post = (static::$model)::findOrFail($request->id);
}
Couldn't figure out how to get the old value of a custom attachment from certain model ,
i added the Attachable trait , and the attachments is working and i can get the default old values using
Upload::value("attachment")
but i added a foreign key in my post model to set a default image ( featured image ) us the Cropper field but i can't preview it , apparently the Cropper::value() accepts the attachment url , and i couldn't link it to a relationship ( hasOne ) .
this is how i did resolve but it seems like a bad workaround :
PostResource
is there another way to do it?
should i add this change by default in the resource class to always get the model instance from the url param?
The text was updated successfully, but these errors were encountered: