$result = mysqli_query($link, $query);
$wallets = mysqli_fetch_assoc($result);
$result = mysqli_query($link, $query);
$wallets = mysqli_fetch_assoc(mysqli_query($link, $query));
if (empty($wallets))
public function store(CategoryRequest $request)
{
$params = $request->all();
unset($params['image']);
if ($request->has('image')) {
$params['image'] = $request->file('image')->store('categories');
}
Category::create($params);
return redirect()->route('categories.index');
}
public function update(CategoryRequest $request, Category $category)
{
$params = $request->all();
unset($params['image']);
if ($request->has('image')) {
Storage::delete($category->image);
$params['image'] = $request->file('image')->store('categories');
}
$category->update($params);
return redirect()->route('categories.index');
}