Level 13
you can use session() helper function to check for a key in session..
if(session()->has('access_token')) { return ''; }
1 like
Summer Sale! All accounts are 50% off this week.
if(empty(session('access_token')) || empty(session('refresh_token')) || empty(session('token_expires'))) {
return '';
}
Is there a cleaner way to write this? are there any useful functions from the session helper that can be used?
As @BishoyWagih mentioned there is a has() function, but it also accepts an array. So you could write it as:
if (!session()->has(['access_token', 'refresh_token', 'token_expires'])) {
return '';
}
Please or to participate in this conversation.