Anonymous
Как упростить код, чтобы он выглядел красиво
Сообщение
Anonymous » 08 ноя 2024, 07:01
Я хочу упростить этот код. Это мой код прямо сейчас:
Код: Выделить всё
$path_booth = $req->file('image_booth')->store('images', 's3');
$path_masak = $req->file('image_masak')->store('images', 's3');
$path_icip = $req->file('image_icip')->store('images', 's3');
$path_selling = $req->file('image_selling')->store('images', 's3');
$url_booth = Storage::disk('s3')->url($path_booth);
$url_masak = Storage::disk('s3')->url($path_masak);
$url_icip = Storage::disk('s3')->url($path_icip);
$url_selling = Storage::disk('s3')->url($path_selling);
$url_arr = array();
array_push($url_arr, $url_booth);
array_push($url_arr, $url_masak);
array_push($url_arr, $url_icip);
array_push($url_arr, $url_selling);
$url = implode(";", $url_arr);
Я хочу создать функцию, которая может вставлять URL-адрес, не так ли?
Подробнее здесь:
https://stackoverflow.com/questions/728 ... ook-pretty
1731038500
Anonymous
Я хочу упростить этот код. Это мой код прямо сейчас: [code]$path_booth = $req->file('image_booth')->store('images', 's3'); $path_masak = $req->file('image_masak')->store('images', 's3'); $path_icip = $req->file('image_icip')->store('images', 's3'); $path_selling = $req->file('image_selling')->store('images', 's3'); $url_booth = Storage::disk('s3')->url($path_booth); $url_masak = Storage::disk('s3')->url($path_masak); $url_icip = Storage::disk('s3')->url($path_icip); $url_selling = Storage::disk('s3')->url($path_selling); $url_arr = array(); array_push($url_arr, $url_booth); array_push($url_arr, $url_masak); array_push($url_arr, $url_icip); array_push($url_arr, $url_selling); $url = implode(";", $url_arr); [/code] Я хочу создать функцию, которая может вставлять URL-адрес, не так ли? Подробнее здесь: [url]https://stackoverflow.com/questions/72877380/how-to-simplify-the-code-to-make-it-look-pretty[/url]