我是laravel的新手,为了学习目的,我正在laravel 5.2做一个项目.但是在更新表单中的数据时我遇到了一些错误.插入,选择和删除查询工作正常,没有任何错误.但是在使用更新查询时,它显示的错误如下所示:
helpers.php第683行中的ErrorException:preg_replace():参数不匹配,pattern是一个字符串,而替换是一个数组
in helpers.php line 683
at HandleExceptions->handleError('2', 'preg_replace(): Parameter mismatch, pattern is a string while replacement is an array', 'F:\xampp\htdocs\multidatatechnologies.com\vendor\laravel\framework\src\Illuminate\Support\helpers.php', '683', array('search' => '\?', 'replace' => array(array('menutype' => 'Fast Food', 'status' => '1'), '2'), 'subject' => 'update `menutypes` set `0` = ? where `id` = ?', 'value' => array('menutype' => 'Fast Food', 'status' => '1')))
at preg_replace('/\?/', array('menutype' => 'Fast Food', 'status' => '1'), 'update `menutypes` set `0` = ? where `id` = ?', '1') in helpers.php line …Run Code Online (Sandbox Code Playgroud) 我是laravel的新手,正在做一个样本项目作为学习目的.我使用命令创建了身份验证:
php artisan make:auth
Run Code Online (Sandbox Code Playgroud)
我已经在Authcontroller.php中为所有成功的登录/注册提供了重定向链接:
protected $redirectTo = '/admin';
Run Code Online (Sandbox Code Playgroud)
所有这些都工作正常,我的问题是当我尝试使用laravel 5.2内置auth控制器上的密码重置选项重置密码时,我可以使用新密码重置旧密码.但重置密码后,它会被重定向到examplelaravel.com/home这样的链接.根据我在Authcontroller.php中的重定向链接(protected $ redirectTo ='/ admin';)fgiven,它不会发送到examplelaravel.com/admin.
在浏览我的laravel项目中的每个文件时,我看到一个名为vendor\laravel\framework\src\Illuminate\Foundation\Auth\RedirectsUsers.php的文件,其中包含如下方法:
public function redirectPath()
{
if (property_exists($this, 'redirectPath')) {
return $this->redirectPath;
}
return property_exists($this, 'redirectTo') ? $this->redirectTo : '/home';
}
Run Code Online (Sandbox Code Playgroud)
我在上述文件中将/ home更改为/ admin,并且在成功修改密码后我的重定向问题得到修复.但我不知道这是否是正确的方法?是否正确编辑供应商文件夹内的文件,就像我上面所做的那样?请帮我.提前致谢.