/**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $format = new Format();
     $format->name = $request->name;
     $format->save();
     return redirect('movie');
 }
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $formats = Format::all();
     $categories = Category::all();
     $output = array('formats' => $formats, 'categories' => $categories);
     return view('user.addBook', compact('output'));
 }
예제 #3
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $format_id = \App\Format::where('first_name', '=', 'video')->pluck('id');
     DB::table('books')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'title' => 'screen cast', 'link' => '1.mp4', 'description' => 'a very witty description', 'thumbnail' => 'thumbnail.png', 'format_id' => $format_id, 'user_id' => 1]);
     $format_id = \App\Format::where('first_name', '=', 'video')->pluck('id');
     DB::table('books')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'title' => 'pdf cast', 'link' => '2.mp4', 'description' => 'a very witty description', 'thumbnail' => 'thumbnail.png', 'format_id' => $format_id, 'user_id' => 1]);
     $format_id = \App\Format::where('first_name', '=', 'video')->pluck('id');
     DB::table('books')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'title' => 'flash cast', 'link' => '3.mp4', 'description' => 'a very witty description', 'thumbnail' => 'thumbnail.png', 'format_id' => $format_id, 'user_id' => 1]);
 }
 public function run()
 {
     Model::unguard();
     $this->clearDbTables();
     foreach ($this->categories as $category) {
         Category::create($category);
     }
     for ($index = 0; $index < 9; $index++) {
         Format::create(['type' => $this->formats . $index]);
     }
     $this->call('AuthorTableSeeder');
     $this->call('UserTableSeeder');
     Model::reguard();
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index($sort = null)
 {
     if ($sort == 'category') {
         $movies = Movie::orderBy('category_id')->get();
         $movies = $movies->sortBy(function ($movie) {
             return $movie->category->name . $movie->title;
         });
     } elseif ($sort == 'format') {
         $movies = Movie::orderBy('format')->orderBy('title')->get();
     } else {
         $movies = Movie::orderBy('title')->get();
     }
     $with['movies'] = $movies;
     $with['formats'] = Format::all();
     $with['categories'] = Category::all();
     return \View::make('movie.list')->with($with);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $format_id = \App\Format::where('meta_name', '=', 'video')->pluck('id');
     DB::table('books')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'title' => 'screen cast', 'link' => '0.mp4', 'description' => 'P4 Screencast Laravel Video Books', 'thumbnail' => 'thumbnail.png', 'format_id' => $format_id, 'user_id' => 1]);
     $format_id = \App\Format::where('meta_name', '=', 'video')->pluck('id');
     DB::table('books')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'title' => 'screen cast', 'link' => '1.mp4', 'description' => 'Gumball: Darwin Plays the Guitar', 'thumbnail' => 'thumbnail1.png', 'format_id' => $format_id, 'user_id' => 1]);
     $format_id = \App\Format::where('meta_name', '=', 'video')->pluck('id');
     DB::table('books')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'title' => 'screen cast', 'link' => '2.mp4', 'description' => 'Gumball: The Fan', 'thumbnail' => 'thumbnail2.png', 'format_id' => $format_id, 'user_id' => 1]);
     $format_id = \App\Format::where('meta_name', '=', 'video')->pluck('id');
     DB::table('books')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'title' => 'screen cast', 'link' => '3.mp4', 'description' => 'Gumball: Sarah The Stalker', 'thumbnail' => 'thumbnail3.png', 'format_id' => $format_id, 'user_id' => 1]);
     $format_id = \App\Format::where('meta_name', '=', 'video')->pluck('id');
     DB::table('books')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'title' => 'screen cast', 'link' => '4.mp4', 'description' => "Howdy Ya'll", 'thumbnail' => 'thumbnail4.png', 'format_id' => $format_id, 'user_id' => 1]);
     $format_id = \App\Format::where('meta_name', '=', 'video')->pluck('id');
     DB::table('books')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'title' => 'flash cast', 'link' => '5.mp4', 'description' => "Zombies Attack", 'thumbnail' => 'thumbnail5.png', 'format_id' => $format_id, 'user_id' => 1]);
     $format_id = \App\Format::where('meta_name', '=', 'video')->pluck('id');
     DB::table('books')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'title' => 'pdf cast', 'link' => '6.mp4', 'description' => "Death Marches On", 'thumbnail' => 'thumbnail6.png', 'format_id' => $format_id, 'user_id' => 1]);
 }
예제 #7
0
 /**
  * @param $format_id
  * @return mixed
  */
 public function destroy($format_id)
 {
     return Format::destroy($format_id);
 }