如果有任何帮助,我将不胜感激,如果有任何帮助,我正在使用laravel多身份验证系统,并且我为管理相关的控制器创建了一个文件夹。我尝试在Admin子文件夹的RegisterController中使用这个类
如果有任何帮助,我将不胜感激,如果有任何帮助,我正在使用laravel多身份验证系统,并且我为管理相关的控制器创建了一个文件夹。我尝试在Admin子文件夹的RegisterController中使用这个类
<?php
namespace App\Http\Controllers\Agent\Auth;
use App\Agent;
use Illuminate\Http\Request;
use App\Jobs\AgentMailQueuer;
use Illuminate\Support\Facades\Hash;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Validator;
class RegisterController extends Controller
{
/**
* Show the register form.
*
* @return \Illuminate\Http\Response
*/
public function showRegisterForm()
{
return view('agent.auth.register',[
'title' => 'Create A New Agent On This Page.',
'registerRoute' => 'agent.register',
]);
}
/**
* Create a new agent instance after a valid registration.
*
* @param array $data
* @return \App\Agent
*/
public function create(Request $request)
{
$this->validate(request(),[
'firstname' => 'required|string|max:255|alpha|min:2',
'lastname' => 'required|string|max:255|alpha|min:2',
'city' => 'required|max:255|min:2',
'state' => 'required|string|max:255|alpha|min:2',
'email' => 'required|string|email|max:255|unique:agents',
'consent' => 'required',
]);
$newAgentId = unique_random('agents', 'aid', 10);
$newAgentGeneratedPassword = unique_random('agents', 'password', 12);
$agent = Agent::Create([
'firstname' => $request['firstname'],
'lastname' => $request['lastname'],
'city' => $request['city'],
'state' => $request['state'],
'email' => $request['email'],
'aid' => $newAgentId,
'password' => Hash::make($newAgentGeneratedPassword),
]);
// Mailing Info to Agents
AgentMailQueuer::dispatch($agent);
return redirect()->to('/agent/register')->with('agentcreated', 'New Agent has been Created and their Credentials have been Succesfully Emailed to them !');
}
}发布于 2019-09-03 00:45:31
通过更改Job类的名称解决了该问题。
(由提问者回答)
https://stackoverflow.com/questions/57748090
复制相似问题