在控制器中使用 auth::loginUsingId ,然后视图中拿不到 auth::check,请教下这什么问题?
public function handleCustomerData(Request $request, Customer $customer)
{
$location = $request->location;
$phone = $request->phone;
$project_name = $request->project_name;
$id = $customer->insertGetId(["location" => $location,
"phone" => $phone, "project_name" => $project_name]);
Auth::loginUsingId($id);
return response()->json(['success' => true, "id" => $id, "check" => Auth::check()]);
}
视图使用
{{Auth::check}} 是null
我要怎么样使用post提交数据做用户登录?
推荐文章: