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); } } /** * delete an icon * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function delete($icon) { if( Storage::exists('public/icons/' . $icon) ) { Storage::delete('public/icons/' . $icon); } return response()->json(null, 204); } }