/** * Update the specified category in storage. * * @param $id * @param UpdateCategoryRequest $request * * @return \Illuminate\Http\RedirectResponse */ public function update($id, UpdateCategoryRequest $request) { $categorySaved = $this->categoryRepository->updateById($id, $request->only('name')); if (!$categorySaved) { Flash::error(trans('cms.something_went_wrong')); return redirect()->back(); } Flash::success(trans('cms.category_updated')); return redirect()->route('cms.articles.categories.edit', $categorySaved); }
/** * Update the specified resource in storage. * * @param UpdateArticleRequest $request * @param int $id * * @return \Illuminate\Http\Response */ public function update($id, UpdateArticleRequest $request) { $article = $this->articleRepository->getById($id); if ($article === null) { Flash::error('cms.article_does_not_exists'); return redirect()->back(); } $category = $this->categoryRepository->getById($request->get('category_id')); $articleUpdated = $this->articleRepository->updateById($id, $request->only(['title', 'description', 'publish', 'source', 'content', 'img_url']), $category); if (!$articleUpdated) { Flash::error(trans('cms.unable_to_update_article')); return redirect()->back(); } Flash::success(trans('cms.article_updated')); $tagsUpdated = $this->articleRepository->updateTagsById($articleUpdated->id, $request->get('tagIds', [])); if (!$tagsUpdated) { Flash::error(trans('cms.unable_to_update_tags')); } return redirect()->route('cms.articles.edit', $articleUpdated); }
/** * Display a listing of the news resource. * * @param Industry $industry * * @return \Illuminate\Http\Response */ public function indexCompanies(Industry $industry) { $companies = $this->industryRepository->getCompanies($industry); return view('ahk.industries.companies.index', compact('industry', 'companies')); }
/** * Display the home resource. * * @return \Illuminate\Http\Response */ public function home() { $industries = $this->industryRepository->all(); return view('ahk.home', compact('industries')); }
/** * Bind data to the view. * * @param View $view * * @return void */ public function compose(View $view) { $view->with('user', Auth::user()); $view->with('locale', App::getLocale()); $view->with('industries', $this->industryRepository->all()); }
/** * Bind data to the view. * * @param View $view * * @return void */ public function compose(View $view) { !session('locale') ?: App::setLocale(session('locale')); $view->with('locale', App::getLocale()); $view->with('industries', $this->industryRepository->all()); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $companies = $this->companyRepository->paginate(4); $industries = $this->industryRepository->all(); return view('ahk.companies.index', compact('companies', 'industries')); }
/** * Show the form for editing the specified resource. * * @param Company $company * * @return \Illuminate\Http\Response */ public function edit(Company $company) { $industries = $this->industryRepository->all()->pluck('name', 'id'); $countries = $this->countryRepository->all()->pluck('name', 'id'); return view('ahk.my.companies.edit', compact('company', 'industries', 'countries')); }