3 years ago

Missing something simple with eloquent

Posted 3 years ago by toneee

Hi All,

I am having a problem with my eloquent setup. I have created a separate authentication provider which works fine, I can CRUD, Login, Password Reset users to a different table. My problem is I am trying to save a post against this user using

            'title' => $request->title,
            'body' => $request->description,

I get this error:

BadMethodCallException in Macroable.php line 81: Method admin does not exist.

and for the life of me I cant see why, I know its something simple and I have probably spent too long looking at it to see it now.


class Post extends Model
        // a post is owned by an admin
        public function admin()
            return $this->belongsTo('App\Admin');
class Admin extends Authenticatable
    // a recruiter can have many jobs
    public function posts()
        return $this->hasMany('App\Post');

Please sign in or create an account to participate in this conversation.