mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-08-09 13:55:01 +02:00
All hardcoded strings replaced by i18n translation
This commit is contained in:
@ -19,29 +19,17 @@ class IconController extends Controller
|
||||
*/
|
||||
public function upload(Request $request)
|
||||
{
|
||||
$messages = [
|
||||
'icon.image' => 'Supported format are jpeg, png, bmp, gif, svg, or webp'
|
||||
];
|
||||
|
||||
$validator = Validator::make($request->all(), [
|
||||
'icon' => 'required|image',
|
||||
], $messages);
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json(['error' => $validator->errors()], 400);
|
||||
}
|
||||
|
||||
$path = $request->file('icon')->storePublicly('public/icons');
|
||||
|
||||
|
||||
// if($request->hasFile('icon')){
|
||||
|
||||
$path = $request->file('icon')->storePublicly('public/icons');
|
||||
|
||||
return response()->json(pathinfo($path)['basename'], 201);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return response()->json('no file in $request', 204);
|
||||
// }
|
||||
return response()->json(pathinfo($path)['basename'], 201);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user