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')]); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { return Rating::all(); }