나는() (인증 :: 사용자 -> 역할 == "XXXX")의 경우를 물어 보면 CandidateEvent 표시 내부Laravel-Event : 이벤트에서 Auth :: user()를 사용하는 방법?
문제 "가 아닌 객체의 속성을 얻기 위해 노력"되는 구성 요소 인증 : 사용자() 내 이벤트에서 작동하지 않습니다.
이벤트 내에서 인증을 사용하는 올바른 방법은 무엇입니까?
public function __construct()
{
if(Auth::user()->role == "XXXX")
{
$candidate = count(Candidate::CountNewCandidate());
}
else
{
$candidate = count(Candidate::CountNewCandidateGroup());
}
$this->data = [ 'cCandidate' => $candidate ];
}
코드 이미지는 좋지 않습니다. 귀하의 질문을 다시 포맷하십시오. –
죄송합니다, 새로운 항목입니다. 그리고 지금? (이벤트 코드) –
사용자를 데이터의 이벤트에 전달합니다. – ceejayoz