vendor categories fx9

This commit is contained in:
merdan 2022-11-18 16:05:36 +05:00
parent 170ae64c85
commit 0a05ad072b
1 changed files with 39 additions and 0 deletions

View File

@ -2,9 +2,11 @@
namespace Sarga\Admin\Http\Controllers;
use Illuminate\Support\Facades\Event;
use Sarga\Shop\Repositories\CategoryRepository;
use Webkul\Attribute\Repositories\AttributeRepository;
use Webkul\Category\Http\Controllers\CategoryController;
use Webkul\Category\Http\Requests\CategoryRequest;
use Webkul\Core\Repositories\ChannelRepository;
class Categories extends CategoryController
@ -17,4 +19,41 @@ class Categories extends CategoryController
$this->categoryRepository = $categoryRepository;
$this->attributeRepository = $attributeRepository;
}
/**
* Store a newly created resource in storage.
*
* @param \Webkul\Category\Http\Requests\CategoryRequest $categoryRequest
* @return \Illuminate\Http\Response
*/
public function store(CategoryRequest $categoryRequest)
{
Event::dispatch('catalog.category.create.before');
$category = $this->categoryRepository->create($categoryRequest->all());
// Event::dispatch('catalog.category.create.after', $category);
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Category']));
return redirect()->route($this->_config['redirect']);
}
/**
* Update the specified resource in storage.
*
* @param \Webkul\Category\Http\Requests\CategoryRequest $categoryRequest
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(CategoryRequest $categoryRequest, $id)
{
Event::dispatch('catalog.category.update.before', $id);
$category = $this->categoryRepository->update($categoryRequest->all(), $id);
// Event::dispatch('catalog.category.update.after', $category);
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Category']));
return redirect()->route($this->_config['redirect']);
}
}