Skip to content

Instantly share code, notes, and snippets.

@freekmurze
Last active May 3, 2016 16:31
Show Gist options
  • Save freekmurze/6d4cee8082851d0f15704b10b492aa12 to your computer and use it in GitHub Desktop.
Save freekmurze/6d4cee8082851d0f15704b10b492aa12 to your computer and use it in GitHub Desktop.
Spark helper functions
<?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();
}
@christophrumpel
Copy link

Nice. Do you a global helper function for such helpers or do you use it in your base controller?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment