예제 #1
0
 /**
  * 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);
 }
예제 #2
0
 /**
  * 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);
 }
예제 #3
0
 /**
  * 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'));
 }
예제 #4
0
 /**
  * Display the home resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function home()
 {
     $industries = $this->industryRepository->all();
     return view('ahk.home', compact('industries'));
 }
예제 #5
0
 /**
  * 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());
 }
예제 #6
0
 /**
  * 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());
 }
예제 #7
0
 /**
  * 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'));
 }
예제 #8
0
 /**
  * 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'));
 }