コード例 #1
0
 /**
  * Show the form for editing a comicbook series
  * GET /content/{title}/edit
  *
  * @param  string  $title
  * @return Response
  */
 public function edit($title)
 {
     //Instance of Comicbook model
     $comic = new Comicbooks();
     //Set variables
     $data['book_title'] = $title;
     $book_id = $comic->series($title)->select('comicdb_books.id as id')->first();
     $data['id'] = $book_id;
     //If book exists, get the issue information and fill the form with it
     if (!is_null($book_id)) {
         $data['book_info'] = $comic->series($title)->select('comicdb_books.id as id', 'book_name', 'publisher_name', 'book_description')->distinct()->get();
         $data['selected_genres'] = $comic->series($title)->select('comicdb_genre.id', 'genre_name')->distinct()->get();
         $data['book_characters'] = $comic->bookcharacters($title)->select('character_name')->distinct()->get();
         $data['book_genres'] = Genres::lists('genre_name', 'id');
         $this->layout->content = View::make('editseries', $data);
     } else {
         return Redirect::to('editseries')->with('postMsg', 'These are not the comics you are looking for.')->withErrors($validator)->withInput();
     }
 }
コード例 #2
0
ファイル: BrowseController.php プロジェクト: sudroid/comicake
 public function getGenres($genre)
 {
     $data['genre_name'] = $genre;
     //Get Genre list from database
     $genre_list = Genres::lists('genre_name');
     //Check and see if Genre is in Genre list. If it doesn't, redirect to error page
     if (!in_array($genre, $genre_list)) {
         return Redirect::to('error');
     } else {
         //Get Genre information
         $data['genre_cover'] = Comicbooks::genres($genre)->select('cover_image')->orderBy('comicdb_books.created_at', 'desc')->distinct()->get();
         $data['genre_works'] = Comicbooks::genres($genre)->select('book_name')->orderBy('comicdb_books.created_at', 'desc')->distinct()->get();
     }
     $this->layout->content = View::make('genre', $data);
 }