Skip to content

Instantly share code, notes, and snippets.

@coreymcmahon
Created February 15, 2015 12:47
Show Gist options
  • Save coreymcmahon/46409ac52efc5a8a700b to your computer and use it in GitHub Desktop.
Save coreymcmahon/46409ac52efc5a8a700b to your computer and use it in GitHub Desktop.
Laravel 5: camel-case to snake-case mapping for eloquent relations has been dropped - http://slashnode.com/definitive-laravel-4-to-laravel-5-migration-guide/
<?php namespace App\Models;
class Article extends Model
{
/** etc... */
public function associatedUsers()
{
return $this->belongsToMany('...');
}
/** etc... */
}
$article = App\Models\Article::find(1);
// below: works in Laravel 4.2, but not Laravel 5
$article->associated_users;
// instead use this
$article->associatedUsers;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment