All of my Laravel Model functions located in the User model refuse to work. They all return Call to undefined method Illuminate\Database\Query\Builder::foo(). If I make a function in another model, the relationships and everything works. I am not sure what I'm doing wrong. Here is my entire User.php file.
<?php
use Illuminate\Auth\UserTrait;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableTrait;
use Illuminate\Auth\Reminders\RemindableInterface;
class User extends Eloquent implements UserInterface, RemindableInterface {
public function seminar()
{
return $this->hasMany('Seminar');
}
use UserTrait, RemindableTrait;
/**
* 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', 'remember_token');
}
Here is an example of another model in the same project
<?php
class Seminar extends Eloquent {
protected $table = 'seminar';
public function user()
{
return $this->belongsTo('User', 'user_id');
}
}
I am also using the Sentry Cartalyst package
foofunction here? If you have question, tell what exactly you do and what error you get for this particular piece of code.fooon the QueryBuilder object and not your model. This may be due to not calling->get()(or another function that executes a statement) at the end of your query. If it isn't that show us your "foo" function and how you're calling it.