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
Hi!
I want upload some pictures from an array, and attach images to posts in orchid panel.
foreach ($movies as $m) {
$post = new Post;
$post->title = $m['title'];
$post->description = $m['desc'];
$post->save();
foreach ($m['img'] as $g) {
$post->attachment()->syncWithoutDetaching($g);
}
}
I try
`
$file = new File(file_get_contents($g);
$attachment = $file->load();
$post->attachment()->syncWithoutDetaching(
$attachment
);
`
and $post->attachment()->syncWithoutDetaching( file_get_contents($attachment) );
But I got error like "Argument 1 passed to Orchid\Attachment\File::__construct() must be an instance of Illuminate\Http\UploadedFile, string given, called in"
But I don't know how to get int from a picture, I want attach for Post model.
Thanks if someone can help me.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
I want upload some pictures from an array, and attach images to posts in orchid panel.
I try
`
`
and
$post->attachment()->syncWithoutDetaching( file_get_contents($attachment) );
But I got error like "Argument 1 passed to Orchid\Attachment\File::__construct() must be an instance of Illuminate\Http\UploadedFile, string given, called in"
But I don't know how to get int from a picture, I want attach for Post model.
Thanks if someone can help me.
Beta Was this translation helpful? Give feedback.
All reactions