Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. // Menu model
  2. public function products(){
  3. return $this->belongsToMany('Product');
  4. }
  5.  
  6. public static function getMenuWithProducts($month, $year){
  7. return self::
  8. where('month', '=', $month)
  9. ->where('year', '=', $year)
  10. ->with('products')
  11. ->get();
  12. }
  13.  
  14. public static function getMenuWithProducts($month, $year){
  15. return self::
  16. where('month', '=', $month)
  17. ->where('year', '=', $year)
  18. ->with('products')
  19. ->with('producer')
  20. ->get();
  21. }
  22.  
  23. BadMethodCallException
  24. Call to undefined method IlluminateDatabaseQueryBuilder::producer()
  25.  
  26. public function products(){
  27. return $this->belongsToMany('Product');
  28. }
  29.  
  30. public function producer()
  31. {
  32. return $this->belongsTo('Producer');
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement