How to create a video collection in Laravel 5 -


i add videos site. have page far called library videos each category.

how work select category, takes page subcategories on list of videos relating subcategory select video , takes video pagewhich plays chosen video.

i have began creating video table following attributes:

  • id
  • title
  • category
  • slug
  • youtube or vimeo link
  • duration

i have looked @ video players , have decided use videojs

i need getting stated , best start.

there couple of ways this, how it.

to link videos across categories , subcategories need couple of tables/models

video.php

category.php

subcategory.php

tables

categories

categoryid

category_name

subcategories

subcategoryid

subcategory_name

categoryid

videos

videoid video_name

slug link

duration

subcategoryid

you have 1 controller performed methods you, or separate them, depending on how many functions going have etc.

i have methods following

  • show page list of categories example need contain like

    public function getcategories() {     $categories = category::all()->lists('category_name', 'categoryid');     return view('categories')->with(compact(categories)); } 
  • show next page subcategories , videos

    public function getsubcategories($categoryid) {     //get subcategories relate selected category , videos     $subcategories = subcategory::join('videos', 'subcategories.subcategoryid', '=', 'videos.subcategoryid')->where('subcategories.categoryid', '=', $categoryid)->get(); } 

then return data view. bare in mind may not exact solution threw together, steers in right direction.


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -