让我知道在路径文件中调用表单字段和控制器并将它们存储到WHMCS中,即将客户端详细信息添加到WHMCS。在下面找到路线以及表格字段。
Route::get('/create', function () {
$users = Whmcs::AddClient([
'firstname' => Input::get('firstname'),
'lastname' => Input::get('lastname'),
'email' => Input::get('email'),
'address1' => Input::get('address1'),
'city' => Input::get('city'),
'state' => Input::get('state'),
'postcode' => Input::get('postcode'),
'country' => Input::get('country'),
'phonenumber' => Input::get('phonenumber'),
'password2' => Input::get('password2'),
'responsetype' => 'json',
]);
return $users;
});
在控制器代码下面找到
class ClientController extends Controller
{
public function insertform(){
return view('clientlayout.main.signup');
}
public function create(){
$firstname = trim(htmlentities($_POST["firstname"]));
}
}
答案 0 :(得分:0)
也许以下内容可能有助于您指明正确的方向: 根据您的要求调整并放置在控制器内。
public function createUser($request)
{
//Create user
$newUser = new User;
$newUser->username = $request->username;
$newUser->first_name = $request->first_name;
$newUser->last_name = $request->last_name;
$newUser->email = $request->email;
$newUser->password = bcrypt($request->password);
$newUser->last_login_at = Carbon::now();
$newUser->save();
//Manually assign the role_id so no escalating privileges.
$newUser->assignRole('user');
return $newUser;
}
答案 1 :(得分:0)
首先,你必须在laravel
中遵循MVC方法<强>路线强>
Route::match(['get','post'],'/create', 'ControllerName@functionname');
<强>控制器强>
public function create(Request $request){
$id = modelname::modelfunctionname($request->Input());
print "<pre>";
print_r ($request->input());
print "</pre>"; exit;
}
$ request-&gt; input()您将获得表单字段
在您的模型中
public static function modelfunctionname($input){
$create = DB::table('admins')->insertGetId(array(
'firstname' => $input['firstname'],
'lastname' => $input['lastname']
like this Do it for remaining field
));
return $create;
}