예제 #1
0
 public function getLists($exploreBy = Null, $slug = Null)
 {
     $projcon = array("0", "3");
     $leftCatList = Genre::all();
     $sortBy = \Input::get('t') ? \Input::get('t') : Null;
     switch ($exploreBy) {
         case "popular":
             $lists = Project::where('active', '1')->where('live', '1')->orderBy('rank', 'DESC')->get();
             break;
         case "recent":
             $lists = Project::where('active', '1')->where('live', '1')->orderBy('created_at', 'desc')->get();
             break;
         case "genres":
             $genre_slug = $slug;
             $catObj = Genre::where('genre_slug', $genre_slug)->first();
             $catName = $catObj->name;
             $lists = Project::where('active', '1')->where('live', '1')->where('project_genre_id', $catObj->id)->orderBy('created_at', 'desc')->get();
             break;
         case "categories":
             $genre_slug = $slug;
             $catObj = Genre::where('genre_slug', $genre_slug)->first();
             $catName = '';
             $lists = Project::where('active', '1')->where('live', '1')->where('project_genre_id', $catObj->id)->orderBy('created_at', 'desc')->get();
             $leftCatList = Category::all();
             break;
         default:
             $lists = Project::where('active', '1')->where('live', '1')->orderBy('id', 'desc')->get();
     }
     $results = $this->project_repo->prepareListObj($lists);
     if ($sortBy != Null) {
         $results = $this->project_repo->sortByPrepareListObj($results, $sortBy);
     }
     return view('project.lists', ['_projectLists' => count($results) > 0 ? (object) $results : $results, '_menus' => $this->menuItems, 'login_url' => $this->login_url, '_catObj' => isset($catObj) ? $catObj : '', '_leftCatLists' => $leftCatList, '_exploreBy' => $exploreBy]);
 }
예제 #2
0
 public function create()
 {
     $formats = Format::all();
     $genres = Genre::all();
     $labels = Label::all();
     $ratings = Rating::all();
     $sounds = Sound::all();
     return view('create', ['formats' => $formats, 'labels' => $labels, 'genres' => $genres, 'ratings' => $ratings, 'sounds' => $sounds]);
 }
예제 #3
0
 public function all($type = Null, $criteria = Null)
 {
     switch ($type) {
         case "project":
             if ($criteria != Null) {
                 $lists = \App\Models\Project::where('status', $criteria)->count();
             } else {
                 $lists = \App\Models\Project::all()->count();
             }
             break;
         case "user":
             $lists = \App\User::all()->count();
             break;
         case "category":
             $lists = \App\Models\Category::all()->count();
             break;
         case "genre":
             $lists = \App\Models\Genre::all()->count();
             break;
         default:
             $lists = 0;
     }
     return $lists;
 }
 public function genres()
 {
     $genres = Genre::all();
     return ['genres' => $genres];
 }
 public function insertdvd(Request $request)
 {
     $format_id = $request->input('format');
     $genre_id = $request->input('genre');
     $label_id = $request->input('label');
     $rating_id = $request->input('rating');
     $sound_id = $request->input('sound');
     $title = $request->input('title');
     $validator = Validator::make($request->all(), ['title' => 'required|min:5']);
     if ($validator->fails()) {
         return redirect("/dvds/create")->withErrors($validator)->withInput();
     }
     $dvd = new DVD();
     $dvd->title = $title;
     $dvd->format_id = $format_id;
     $dvd->genre_id = $genre_id;
     $dvd->label_id = $label_id;
     $dvd->rating_id = $rating_id;
     $dvd->sound_id = $sound_id;
     $dvd->save();
     $request->session()->flash('success', 'DVD successfully added!');
     $formats = Format::all();
     $genres = Genre::all();
     $labels = Label::all();
     $ratings = Rating::all();
     $sounds = Sound::all();
     return view('create', ['formats' => $formats, 'genres' => $genres, 'labels' => $labels, 'ratings' => $ratings, 'sounds' => $sounds, 'success' => $request->session()->get('success')]);
 }
 public function create()
 {
     return view('create', ['genres' => Genre::all(), 'ratings' => Rating::all(), 'labels' => Label::all(), 'sounds' => Sound::all(), 'formats' => Format::all()]);
 }
 public function search()
 {
     $genres = Genre::all();
     $ratings = DB::table('ratings')->select('id', 'rating_name')->get();
     return view('dvd.search', ['genres' => $genres, 'ratings' => $ratings]);
 }
 public function index()
 {
     return ["genres" => Genre::all()];
 }
 public function index()
 {
     return ['genres' => Genre::all()];
 }
 public function getGenres()
 {
     $genres = Genre::all();
     $response = json_encode(array('genres' => $genres));
     return $response;
 }