Last active
May 3, 2016 16:31
-
-
Save freekmurze/6d4cee8082851d0f15704b10b492aa12 to your computer and use it in GitHub Desktop.
Spark helper functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @return \App\User|null | |
*/ | |
function currentUser() | |
{ | |
return request()->user(); | |
} | |
/** | |
* @return \App\Team|null | |
*/ | |
function currentTeam() | |
{ | |
if (!request()->user()) { | |
return null; | |
} | |
return request()->user()->currentTeam(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice. Do you a global helper function for such helpers or do you use it in your base controller?