Модель пользователя Laravel Sentry с отношениями

У меня есть модель пользователя:

use Cartalyst\Sentry\Users\Eloquent\User as SentryModel;

class User extends SentryModel {

public function raspberries() {
return $this->hasMany('Raspberry');
}

}

И SentryModel:

<?php

use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableInterface;

class SentryModel extends Eloquent implements UserInterface, RemindableInterface {

/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'users';

/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = array('password');

/**
* Get the unique identifier for the user.
*
* @return mixed
*/
public function getAuthIdentifier()
{
return $this->getKey();
}

/**
* Get the password for the user.
*
* @return string
*/
public function getAuthPassword()
{
return $this->password;
}

/**
* Get the e-mail address where password reminders are sent.
*
* @return string
*/
public function getReminderEmail()
{
return $this->email;
}

}

И Малина Модель:

class Raspberry extends Eloquent{

# Relations
public function user(){
return $this->belongsTo('User');
}
}

И теперь я хочу выбрать все Rasberries из моего зарегистрированного пользователя:

$data = Sentry::getUser()->raspberries()->paginate(10);

Но это не работает, я получил сообщение об ошибке:

BadMethodCallException

Вызов неопределенного метода
Осветить \ Database \ Query \ Builder :: малину ()

Зачем?

1

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector