public function storeGenre() { $input = $this->request->request->all(); // Validate the data if (($validator = Genre::validate($input)) !== true) { session()->addErrors($validator); session()->flashInput($input); return redirect(l('admin/dvds/genre/add')); } // Create the user $genre = new Genre(); $genre->create(['name' => $input['name']]); session()->addSuccess('Genre successfully added'); return redirect(l('admin/dvds/genres')); }
/** * Run the database seeds. * * @return void */ public function run() { try { //DELETE TABLES DB::table('osu_genres')->delete(); DB::table('osu_languages')->delete(); //COUNTS if (!DB::table('osu_counts')->where('name', 'pp_rank_column')->get()) { DB::table('osu_counts')->insert([['name' => 'pp_rank_column', 'count' => 90], ['name' => 'usercount', 'count' => 500000]]); } //END COUNTS //GENRES DB::table('osu_genres')->insert([['genre_id' => 99, 'name' => 'Any'], ['genre_id' => 1, 'name' => 'Unspecified'], ['genre_id' => 2, 'name' => 'Video Game'], ['genre_id' => 3, 'name' => 'Anime'], ['genre_id' => 4, 'name' => 'Rock'], ['genre_id' => 5, 'name' => 'Pop'], ['genre_id' => 6, 'name' => 'Other'], ['genre_id' => 7, 'name' => 'Novelty'], ['genre_id' => 9, 'name' => 'Hip Hop'], ['genre_id' => 10, 'name' => 'Electronic']]); $any_genre = \App\Models\Genre::find(99); $any_genre->genre_id = 0; $any_genre->save(); // END GENRES //LANGUAGES DB::table('osu_languages')->insert([['language_id' => 99, 'name' => 'Any', 'display_order' => 0], ['language_id' => 1, 'name' => 'Other', 'display_order' => 11], ['language_id' => 2, 'name' => 'English', 'display_order' => 1], ['language_id' => 3, 'name' => 'Japanese', 'display_order' => 6], ['language_id' => 4, 'name' => 'Chinese', 'display_order' => 2], ['language_id' => 5, 'name' => 'Instrumental', 'display_order' => 10], ['language_id' => 6, 'name' => 'Korean', 'display_order' => 7], ['language_id' => 7, 'name' => 'French', 'display_order' => 3], ['language_id' => 8, 'name' => 'German', 'display_order' => 4], ['language_id' => 9, 'name' => 'Swedish', 'display_order' => 9], ['language_id' => 10, 'name' => 'Spanish', 'display_order' => 8], ['language_id' => 11, 'name' => 'Italian', 'display_order' => 5]]); $any_language = \App\Models\Language::find(99); $any_language->language_id = 0; $any_language->save(); //END LANGUAGES } catch (\Illuminate\Database\QueryException $e) { echo $e->getMessage() . "\r\n"; } catch (Exception $ex) { echo $ex->getMessage() . "\r\n"; } }
public function genreId($id) { $genre = Genre::find($id); if (!$genre) { return Response::json(['error' => 'Genre not found'], 404); } return ['genre' => $genre]; }
public function show($id) { $genres = Genre::find($id); if (!$genres) { return Response::json(['error' => 'Genre not found'], 404); } return ['genres' => $genres]; }
public function create() { $formats = Format::all(); $labels = Label::all(); $genres = Genre::all(); $sounds = Sound::all(); $ratings = Rating::all(); return view('create', ['formats' => $formats, 'labels' => $labels, 'sounds' => $sounds, 'genres' => $genres, 'ratings' => $ratings]); }
public function getGenre($genreID) { $genre = Genre::find($genreID); if (!$genre) { return response()->json(['error' => 'Genre not found'], 404); } else { return json_encode(array('genre' => $genre)); } }
public function actionUpdate($id) { $model = $this->findModel($id); $genres = Genre::find()->all(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('update', ['model' => $model, 'genres' => $genres]); } }
public function findUniqueGenres($dvds) { $added = []; $genres = []; foreach ($dvds as $dvd) { if (!array_key_exists($dvd->genre_id, $added)) { $added[$dvd->genre_id] = true; $genres[] = Genre::find($dvd->genre_id); } } return $genres; }
public function index() { $fractal = new Manager(); $languages = Language::listing(); $genres = Genre::listing(); $data = new Collection(BeatmapSet::listing(), new BeatmapSetTransformer()); $beatmaps = $fractal->createData($data)->toArray(); // temporarily put filters here $modes = [['id' => null, 'name' => trans('beatmaps.mode.any')], ['id' => Beatmap::OSU, 'name' => trans('beatmaps.mode.osu')], ['id' => Beatmap::TAIKO, 'name' => trans('beatmaps.mode.taiko')], ['id' => Beatmap::FRUITS, 'name' => trans('beatmaps.mode.fruits')], ['id' => Beatmap::MANIA, 'name' => trans('beatmaps.mode.mania')]]; $statuses = [['id' => null, 'name' => trans('beatmaps.status.any')], ['id' => 0, 'name' => trans('beatmaps.status.ranked-approved')], ['id' => 1, 'name' => trans('beatmaps.status.approved')], ['id' => 2, 'name' => trans('beatmaps.status.faves')], ['id' => 3, 'name' => trans('beatmaps.status.modreqs')], ['id' => 4, 'name' => trans('beatmaps.status.pending')], ['id' => 5, 'name' => trans('beatmaps.status.graveyard')], ['id' => 6, 'name' => trans('beatmaps.status.my-maps')]]; $extras = [['id' => 0, 'name' => trans('beatmaps.extra.video')], ['id' => 1, 'name' => trans('beatmaps.extra.storyboard')]]; $ranks = [['id' => 'XH', 'name' => trans('beatmaps.rank.silver-ss')], ['id' => 'X', 'name' => trans('beatmaps.rank.ss')], ['id' => 'SH', 'name' => trans('beatmaps.rank.silver-s')], ['id' => 'S', 'name' => trans('beatmaps.rank.s')], ['id' => 'A', 'name' => trans('beatmaps.rank.a')], ['id' => 'B', 'name' => trans('beatmaps.rank.b')], ['id' => 'C', 'name' => trans('beatmaps.rank.c')], ['id' => 'D', 'name' => trans('beatmaps.rank.d')]]; $filters = ['data' => compact('modes', 'statuses', 'genres', 'languages', 'extras', 'ranks')]; return view('beatmaps.index', compact('filters', 'beatmaps')); }
public function index() { $languages = Language::listing(); $genres = Genre::listing(); $beatmaps = json_collection(Beatmapset::listing(), new BeatmapsetTransformer(), 'beatmaps'); // temporarily put filters here $modes = [['id' => null, 'name' => trans('beatmaps.mode.any')]]; foreach (Beatmap::MODES as $name => $id) { $modes[] = ['id' => (string) $id, 'name' => trans("beatmaps.mode.{$name}")]; } $statuses = [['id' => '7', 'name' => trans('beatmaps.status.any')], ['id' => '0', 'name' => trans('beatmaps.status.ranked-approved')], ['id' => '1', 'name' => trans('beatmaps.status.approved')], ['id' => '8', 'name' => trans('beatmaps.status.loved')], ['id' => '2', 'name' => trans('beatmaps.status.faves')], ['id' => '3', 'name' => trans('beatmaps.status.modreqs')], ['id' => '4', 'name' => trans('beatmaps.status.pending')], ['id' => '5', 'name' => trans('beatmaps.status.graveyard')], ['id' => '6', 'name' => trans('beatmaps.status.my-maps')]]; $extras = [['id' => '0', 'name' => trans('beatmaps.extra.video')], ['id' => '1', 'name' => trans('beatmaps.extra.storyboard')]]; $ranks = []; foreach (['XH', 'X', 'SH', 'S', 'A', 'B', 'C', 'D'] as $rank) { $ranks[] = ['id' => $rank, 'name' => trans("beatmaps.rank.{$rank}")]; } $filters = compact('modes', 'statuses', 'genres', 'languages', 'extras', 'ranks'); return view('beatmaps.index', compact('filters', 'beatmaps')); }
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 show($id) { $genre = Genre::find($id); $dvds = Dvd::with('rating', 'genre', 'label')->where('genre_id', '=', $id)->get(); return view('genre', ['genre' => $genre, 'dvds' => $dvds]); }
public function projectedit(ProjectRepository $project_repo) { $categories = Category::lists('name', 'id'); $genres = Genre::lists('name', 'id'); $g_countries = Country::lists('countryName', 'countryID'); $step_value = Session::get('editfstep'); $edit_id = Session::has('editfs_id') ? Session::get('editfs_id') : ''; $statArr = array('' => " -- Select -- "); $countries = array_merge($statArr, $g_countries); if (isset($edit_id)) { $projectdet = Project::where('id', $edit_id)->first(); } else { $projectdet = array(); } $gountryId = $projectdet['country_id']; $citylist = $this->project_repo->getcitylist($gountryId); $datan = array(); foreach ($citylist as $cityval) { $id = $cityval['cityID']; $name = $cityval['cityName']; $datan[$id] = $name; } $rewardlist = $this->project_repo->getrewarddata($edit_id); if ($step_value == 1) { return view('project.startaproject-edit', ['last_insert_id' => $edit_id, 'categories' => $categories, 'genres' => $genres, 'projectdet' => $projectdet, '_menus' => $this->menuItems, 'login_url' => $this->login_url]); } elseif ($step_value == 2) { return view('project.startaproject-step2-edit', ['last_insert_id' => $edit_id, 'countries' => $countries, 'projectdet' => $projectdet, 'citylist' => $datan, '_menus' => $this->menuItems, 'login_url' => $this->login_url]); } elseif ($step_value == 3) { $prewordstat = $this->project_repo->projectrewordd($edit_id); if ($prewordstat > 0) { $rview = 'project.startaproject-step3-edit'; } else { $rview = 'project.startaproject-step3'; } return view($rview, ['rewardlist' => $rewardlist, 'last_insert_id' => $edit_id, 'projectdet' => $projectdet, '_menus' => $this->menuItems, 'login_url' => $this->login_url]); } elseif ($step_value == 4) { return view('project.project.create-step4', ['last_insert_id' => $edit_id, '_menus' => $this->menuItems, 'login_url' => $this->login_url]); } elseif ($step_value == 5) { return view('project.startaproject-confirmation', ['last_insert_id' => $edit_id, 'projectdet' => $projectdet, '_menus' => $this->menuItems, 'login_url' => $this->login_url]); } else { return view('project.project.editproject', ['last_insert_id' => $edit_id, '_menus' => $this->menuItems, 'login_url' => $this->login_url]); } }
public function genreDVDs(Request $request, $genre_id) { $dvds = DVD::with('rating', 'genre', 'label')->where('genre_id', "{$genre_id}")->get(); $genre_name = ''; $genre = Genre::where('id', "{$genre_id}")->first(); if (!empty($genre)) { $genre_name = $genre->genre_name; } return view('genre_results', ['dvds' => $dvds, 'genre_name' => $genre_name]); return view('genre_results'); }
public function getGenresName() { return $this->hasMany(Genre::className(), ['id' => 'genre_id'])->viaTable('genre_book', ['book_id' => 'id']); }
public function getEditproject(ProjectRepository $project_repo) { $users = User::lists('name', 'id'); $categories = Category::lists('name', 'id'); $genres = Genre::lists('name', 'id'); $g_countries = Country::lists('countryName', 'countryID'); $step_value = Session::get('editstep'); $edit_id = Session::has('edit_id') ? Session::get('edit_id') : ''; $statArr = array('' => " -- Select -- "); $countries = array_merge($statArr, $g_countries); if (isset($edit_id)) { $projectdet = Project::where('id', $edit_id)->first(); } else { $projectdet = array(); } $gountryId = $projectdet['country_id']; /* $getCitylist = $this->project_repo->getcitylist($gountryId); echo "<pre>"; print_r($getCitylist); exit; $statArr = array( 0 => array( 'cityID' => '', 'cityName' => 'Select City' ) ); $result = array_merge($statArr, $citylist); */ $citylist = $this->project_repo->getcitylist($gountryId); $datan = array(); foreach ($citylist as $cityval) { $id = $cityval['cityID']; $name = $cityval['cityName']; $datan[$id] = $name; } $rewardlist = $this->project_repo->getrewarddata($edit_id); $url = config('medias.url'); $func = "edit"; if ($step_value == 1) { return view('admin.project.editproject', ['func' => $func, 'url' => $url, 'last_insert_id' => $edit_id, 'categories' => $categories, 'genres' => $genres, 'users' => $users, 'projectdet' => $projectdet]); } elseif ($step_value == 2) { return view('admin.project.create-step2-edit', ['func' => $func, 'url' => $url, 'last_insert_id' => $edit_id, 'countries' => $countries, 'projectdet' => $projectdet, 'citylist' => $datan]); } elseif ($step_value == 3) { return view('admin.project.create-step3-edit', ['func' => $func, 'url' => $url, 'rewardlist' => $rewardlist, 'last_insert_id' => $edit_id, 'projectdet' => $projectdet]); } elseif ($step_value == 4) { return view('admin.project.create-step4', ['func' => $func, 'url' => $url, 'last_insert_id' => $edit_id]); } elseif ($step_value == 5) { return view('admin.project.confirmation', ['func' => $func, 'url' => $url, 'last_insert_id' => $edit_id]); } else { return view('admin.project.editproject', ['func' => $func, 'url' => $url, 'last_insert_id' => $edit_id]); } }
public function getChangepresentstatus($projectid, $projectstatus) { $category = Genre::find($projectid); $category->active = $projectstatus; $category->save(); }
public function genres($id) { $genre = Genre::find($id); $dvds = Dvd::with('genre', 'rating', 'label')->where('genre_id', '=', "{$id}")->get(); return view('genre', ['dvds' => $dvds, 'genre' => $genre]); }
/** * Run the database seeds. * * @return void */ public function run() { foreach ($this->genres as $genre) { Genre::create($genre); } }
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 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')]); }
/** * Finds the Genre model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Genre the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Genre::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * Show the application welcome screen to the user. * * @return Response */ public function getIndex() { $menuItems = Menu::where('active', '1')->orderBy('weight', 'asc')->get(); return view('welcome', ['_featuredProducts' => count($this->Projectlist(Null, 'popular')) > 0 ? (object) $this->Projectlist(Null, 'popular') : $this->Projectlist(Null, 'popular'), '_recently_added' => count($this->Projectlist(Null, 'latest')) > 0 ? (object) $this->Projectlist(Null, 'latest') : $this->Projectlist(Null, 'latest'), '_menus' => $menuItems, 'login_url' => $this->login_url, '_categoryLists' => Category::where('active', '1')->orderBy('id', 'asc')->get(), '_genreLists' => Genre::where('active', '1')->orderBy('id', 'asc')->get(), '_projectLists' => count($this->Projectlist()) > 0 ? (object) $this->Projectlist() : $this->Projectlist(), '_sliders' => Banner::where('active', '1')->orderBy('weight', 'asc')->get()]); }
public function create() { return view('create', ['genres' => Genre::all(), 'ratings' => Rating::all(), 'labels' => Label::all(), 'sounds' => Sound::all(), 'formats' => Format::all()]); }
/** * Add a dvd to the database * If you're curious where a million db requests are coming from, it's here. * @param array $input * @return bool */ public function create(array $input) { $dvd = $this->dvdInfo->firstOrCreate(['title' => $input['title'], 'description' => $input['description'], 'length' => $input['length'], 'cover_image' => $input['cover_image']]); $price = Price::firstOrCreate(['price_whole' => $input['price_whole'], 'price_cents' => $input['price_cents'], 'late_fee_whole' => $input['late_fee_whole'], 'late_fee_cents' => $input['late_fee_cents'], 'points' => $input['points']]); $input['price_id'] = $price->id; // Insert producers for ($i = 0; $i < sizeof($input['producer_name']); $i++) { $producer = Producer::firstOrCreate(['name' => $input['producer_name'][$i]]); $dvd->producers()->attach($producer); } // Insert genres for ($i = 0; $i < sizeof($input['genre']); $i++) { $genre = Genre::firstOrCreate(['genre' => $input['genre'][$i]]); $dvd->genres()->attach($genre); } // Insert actors for ($i = 0; $i < sizeof($input['actor_name']); $i++) { $actor = Actor::firstOrCreate(['name' => $input['actor_name'][$i]]); $dvd->actors()->attach($actor, ['character_name' => $input['character_name'][$i]]); } // Add new dvd stock $newDvds = []; for ($i = 0; $i < $input['stock']; $i++) { array_push($newDvds, new DVD($input)); } $dvd->dvds()->saveMany($newDvds); foreach ($newDvds as $newDvd) { // Insert languages for ($i = 0; $i < sizeof($input['language_name']); $i++) { $language = Language::firstOrCreate(['language' => $input['language_name'][$i]]); $newDvd->languages()->attach($language); } // Insert subtitles for ($i = 0; $i < sizeof($input['subtitle_name']); $i++) { $subtitle = Language::firstOrCreate(['language' => $input['subtitle_name'][$i]]); $newDvd->subtitles()->attach($subtitle); } } }
public function display_dvds_by_genre($genre_id) { $dvds = Dvd::with('genre', 'rating', 'label')->where('genre_id', '=', $genre_id)->get(); $genre = Genre::find($genre_id); return view("dvds_by_genre", ['dvds' => $dvds, 'genre' => $genre]); }