Exemplo n.º 1
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]);
 }
 public function create()
 {
     return view('create', ['genres' => Genre::all(), 'ratings' => Rating::all(), 'labels' => Label::all(), 'sounds' => Sound::all(), 'formats' => Format::all()]);
 }
 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')]);
 }
Exemplo n.º 4
0
 /**
  * @SWG\Api(
  *   path="/format/all",
  *   @SWG\Operation(
  *     nickname="Get all formats",
  *     method="GET",
  *     summary="Find all formats",
  *     notes="Returns all formats",
  *     type="array",
  *     @SWG\Items("Format"),
  *     authorizations={}
  *   )
  * )
  */
 public function all()
 {
     $statusCode = 200;
     $response = [];
     $formatModels = Models\Format::all();
     foreach ($formatModels as $formatModel) {
         $formatView = new ModelViews\Format($formatModel);
         $response[] = $formatView->get();
     }
     return \Response::json($response, $statusCode);
 }