/* Place uploaded images into appropriate columns. */
for($i = 1; $i <= 5; $i++)
{
if(Input::file('image' . $i . '.size') >= 1)
{
$randomName = substr( md5( rand(1,9999999) ), 1, 15);
Input::upload('image' . $i, path('public') . 'uploads/backgrounds/', Auth::user()->username . $randomName . '.jpg');
$wedding= Wedding::where('wedding_owner', '=', Auth::user()->username)->first();
$wedding->image1 = $randomName;
$wedding->save();
}
}
ユーザーは 5 枚の写真をアップロードできます。アップロードした画像は に配置する必要がありimage1, image2, image3, image4 and image5 columns
ますwedding table
。
基本的、
$wedding->image1 = $randomName;
次のようになります。
$wedding->image{$i} = $randomName;
どうすればこれを解決できますか?