Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/234.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 默认用户模型在laravel中抛出错误_Php_Class_Laravel_Model - Fatal编程技术网

Php 默认用户模型在laravel中抛出错误

Php 默认用户模型在laravel中抛出错误,php,class,laravel,model,Php,Class,Laravel,Model,当我试图使用laravel中的默认模型“User”时,它会抛出错误。我试过的是 $user = new User(); $user->email = Input::get('email'); $user->password = Hash::make(Input::get('password')); $user->name = "Blah Blah"; $user->access_type = "admin"; $user->access_status = 1; $u

当我试图使用laravel中的默认模型“User”时,它会抛出错误。我试过的是

$user = new User();
$user->email = Input::get('email');
$user->password = Hash::make(Input::get('password'));
$user->name = "Blah Blah";
$user->access_type = "admin";
$user->access_status = 1;
$user->save();
抛出的错误是

Symfony \ Component \ Debug \ Exception \ FatalErrorException

Call to undefined method User::save()
问题是什么?我还尝试了
User::all()
来检索这些值,这也引发了对未定义方法User::all()的错误
调用

更新1: 这是我的模型

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

class User 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 token value for the "remember me" session.
     *
     * @return string
     */
    public function getRememberToken()
    {
        return $this->remember_token;
    }

    /**
     * Set the token value for the "remember me" session.
     *
     * @param  string  $value
     * @return void
     */
    public function setRememberToken($value)
    {
        $this->remember_token = $value;
    }

    /**
     * Get the column name for the "remember me" token.
     *
     * @return string
     */
    public function getRememberTokenName()
    {
        return 'remember_token';
    }

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

}
更新2:
我试着以
Users
的身份编写另一个模型名和类名,这非常有效。但是对于身份验证,它必须是
用户
表,对吗?

可能用户是一个保留字,只需给模型另起一个名字,比如UserTbl

仍然没有收到我问题的任何答案。无论如何,现在我使用名为
Users
的新模型运行它,同时考虑到同样的疑问。

问题的原因是自动加载错误的“用户”模型。请查看“/vendor/composer/autoload_classmap.php”文件。在返回数组中,键“User”的值必须是
$baseDir'/app/models/User.php

return array(
...,
'User' => $baseDir . '/app/models/User.php',
...,
);

你能在问题中添加你的用户模型代码吗..除了默认文件中的表名,我没有做太多更改。我会更新的。你能试试$user=new user。。。(没有函数括号)我认为还有其他一些默认函数覆盖了这个模型。有没有办法调试那个东西?这是laravel的全新安装,这是我唯一的功能。所以这不是我的错。尝试扩展\雄辩…看起来雄辩没有扩展..这并不能提供问题的答案。若要评论或要求作者澄清,请在其帖子下方留下评论-您可以随时对自己的帖子发表评论,一旦您有足够的评论,您就可以发表评论。感谢您的澄清