Laravel 5无法访问特征功能

时间:2017-03-21 15:07:24

标签: php laravel traits

为什么我无法访问ResetsPasswords特征函数?

它只是在这个控制器上,因为在其他控制器上我可以完美地访问特征函数。

基本上我复制了授权码,因为我有两种类型的用户,即候选人和公司。我正在尝试重置候选人的密码。我可以使用这两种类型轻松注册和登录。

以下是代码:

namespace App\Http\Controllers\CandidateUserAuth;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Foundation\Auth\ResetsPasswords;

use Illuminate\Support\Facades\Config;

class ResetPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/

use ResetsPasswords;

/**
 * Create a new controller instance.
 *
 * @return void
 */
public function __construct()
{
    //Change the default guard and password set in auth.php
    Config::set("auth.defaults.guard","candidate");
    Config::set("auth.defaults.passwords","candidates");
    $this->middleware('guest');
}

//Check to see if really needed
protected function guard()
{
    return Auth::guard('candidates');
}

//Override of original function in the trait ResetsPasswords
public function showResetForm(Request $request, $token = null)
{
    return view('candidate-auth.passwords.reset')->with(
        ['token' => $token, 'email' => $request->email]
    );
}
}

编辑:我想使用路由中的特征函数reset(): Route::post('candidate/password/reset','CandidateUserAuth\ResetPasswordController@reset');

这是函数的开头,它有一个dd()帮助器:

public function reset(Request $request)
{
    dd("Hello");
    $this->validate($request, $this->rules(), $this->validationErrorMessages());

0 个答案:

没有答案