Advertisement
Guest User

Laravel 3 vs 4

a guest
Aug 11th, 2013
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.61 KB | None | 0 0
  1. //Laravel 3 Site Model i can do somethink like that:
  2. public function adformats()  {
  3.     return $this->has_many_and_belongs_to('Adformat','sites_adformats')->with('zone_id');
  4. }
  5.  
  6. In my Laravel 3 Controller i can do somethink like that:
  7. $site->adformats()->pivot()->where('site_id','=',$site->id)->where('adformat_id','=',$adformatid)->update(array('zone_id' => $zoneid));
  8.  
  9. What do I need to do in Laravel 4?
  10. In My Model i do this:
  11. public function adformats()  {
  12.     return $this->belongsToMany('Adformat','sites_adformats')->withPivot('zone_id');
  13. }
  14. Is that right?
  15.  
  16. How can access it now in Controller in Laravel 4?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement