예제 #1
0
 public function show($tagID)
 {
     $tagID = json_decode($tagID);
     $count = (bool) \Input::get('count');
     if (is_array($tagID)) {
         $tags = Cache::remember('tags_' . json_encode($tagID), 15, function () use($tagID) {
             return Tag::with('posts')->whereIn('id', $tagID)->get();
         });
     } else {
         $tags = array(Cache::remember('tag_' . $tagID, 15, function () use($tagID) {
             return Tag::with('posts')->find($tagID);
         }));
     }
     if ($count) {
         for ($i = 0; $i < count($tags); $i++) {
             $tags[$i]->count = count($tags[$i]->posts);
             unset($tags[$i]->posts);
         }
     }
     return self::makeResponse($tags);
 }
예제 #2
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $categories = Category::with('translations')->get();
     $amenities = Tag::with('translations')->get();
     return view('dashboard.spaces.create', compact('categories', 'amenities'));
 }
예제 #3
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $model = Tag::with('posts')->get()->toArray();
     return response()->json(['error' => false, 'data' => ['tags' => $model, 'counts' => count($model)]], 200);
 }
예제 #4
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int $id
  *
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $venue = Venue::where('id', $id)->first();
     $categories = Category::with('translations')->get();
     $amenities = Tag::with('translations')->get();
     return view('dashboard.venues.edit', compact('venue', 'categories', 'amenities'));
 }
예제 #5
0
 public function index($id)
 {
     $g = Tag::with('groups')->find($id)->toArray();
     dd($g);
 }