daily pastebin goal
49%
SHARE
TWEET

Laravel 3 vs 4

a guest Aug 11th, 2013 33 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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?
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top