Inheritance: extends Prettus\Repository\Eloquent\BaseRepository
Esempio n. 1
0
 /**
  * Display a listing of the resource based on a tag.
  *
  * @param $slug
  *
  * @return \Illuminate\View\View
  */
 public function tag($slug)
 {
     $tag = $this->tags->findByField('slug', $slug)->first();
     $posts = $tag->posts()->with(['author', 'tags'])->paginate(5);
     $tags = $this->tags->all();
     return view('frontend.pages.blog.tag', compact('tag', 'posts', 'tags'));
 }
Esempio n. 2
0
 public function store(PostRequest $request, TagRepository $tagRepository)
 {
     $inputs = array_merge($request->all(), ['user_id' => $request->user()->id]);
     $post = $this->postRepository->store($inputs);
     if (isset($inputs['tags'])) {
         $tagRepository->store($post, $inputs['tags']);
     }
     return redirect(route('post.index'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $tu = $this->userRepository->getTotal();
     $tp = $this->productRepository->getTotal();
     $tc = $this->categoryRepository->getTotal();
     $tt = $this->tagRepository->getTotal();
     $op = Option::count();
     $pm = $this->paymentRepository->getTotal();
     return View('admin.dashboard.index')->with(compact('tu', 'tp', 'tc', 'tt', 'op', 'pm'));
 }
Esempio n. 4
0
 /**
  * Save the tags for the Post.
  *
  * @param array $data
  * @param       $post
  */
 protected function saveTags(array $data, $post)
 {
     $tags = explode(',', $data['tags']);
     foreach ($tags as $tag) {
         Tag::firstOrCreate(['name' => $tag, 'slug' => str_slug($tag)]);
     }
     $post->tags()->sync($this->tags->findWhereIn('name', $tags)->pluck('id')->toArray());
 }
Esempio n. 5
0
 /**
  * Update an item
  *
  * @param $inputs
  * @return bool
  */
 public function update($inputs)
 {
     /* @var $item Item */
     $item = $this->itemsRepo->get($inputs['itemId']);
     $item->value = $inputs['value'];
     $item->description = $inputs['description'];
     $subclass = get_class($item->itemable);
     if ($subclass == 'App\\Models\\Link') {
         $item->itemable->title = $inputs['value'];
     }
     // Tags
     $this->tagsRepo->updateForItem($item, $inputs, Auth::user());
     // Cache
     $this->cacheHandler->del(CacheHandlerInterface::MAINPAGE);
     $this->cacheHandler->del(CacheHandlerInterface::TAGS);
     // Save
     $item->save();
     // Update Search
     $this->searchHandler->update($item->itemable);
     return $item;
 }
Esempio n. 6
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit(TagRepository $tag, SourceRepository $source, $id)
 {
     $routeName = 'map';
     $routeMethod = 'edit';
     $map = $this->map->getById($id);
     if (!$map) {
         return redirect()->route('admin.map.index');
     }
     $tags = $tag->getAllOrderedBy('name');
     $sources = $source->getAllOrderedBy('name');
     $environment = collect(['settings' => \Cache::get('settings')]);
     $environment = $environment->toJSON();
     $data = compact('routeName', 'routeMethod', 'map', 'tags', 'sources', 'environment');
     \Clockwork::info($data);
     return view('admin.sections.map.edit', $data);
 }
Esempio n. 7
0
 /**
  * Remove the specified resource from storage.
  *
  * @param int $id
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function destroy($id)
 {
     $this->tags->delete($id);
     return redirect()->route('admin.tags.index');
 }
 /**
  * Redirect to tags with default tag.
  *
  * @param $id
  * @return \Illuminate\Http\RedirectResponse
  */
 public function showTag($id)
 {
     $tag = $this->tag->getById($id);
     return redirect('/tags')->with('default', $tag);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $this->tagRepository->destroy($id);
     Flash::message('Tag Deleted');
     return Redirect()->route('tags');
 }
Esempio n. 10
0
 /**
  * Display a listing of the resource based on a tag.
  *
  * @param $slug
  *
  * @return \Illuminate\View\View
  */
 public function tag($slug)
 {
     $tag = $this->tags->findByField('slug', $slug)->first();
     $works = $tag->works()->paginate(5);
     return view('frontend.pages.works.tag', compact('tag', 'works'));
 }
Esempio n. 11
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\View\View
  */
 public function index()
 {
     $works = $this->works->with('tags')->all();
     $tags = $this->tags->has('works')->all();
     return view('frontend.pages.works.index', compact('works', 'tags'));
 }