Commit 179386cd authored by Othneil Drew's avatar Othneil Drew
Browse files

Update twig user file

No related merge requests found
Showing with 12 additions and 1 deletion
+12 -1
......@@ -2,6 +2,7 @@
namespace Snaju\Inception\Route\Loaders\Twig\Extensions;
use App\Models\User;
use Snaju\Inception\Http\Message\FlashMessage;
use Snaju\Inception\InceptionCore;
use Twig\Extension\AbstractExtension;
......@@ -20,6 +21,7 @@ class CustomFunctions extends AbstractExtension {
new TwigFunction('getFlashMessage', [$this, 'getFlashMessage']),
new TwigFunction('getFlashMessages', [$this, 'getFlashMessages']),
new TwigFunction('getFullYear', [$this, 'getFullYear']),
new TwigFunction('getUser', [$this, 'getUser']),
);
}
......@@ -32,7 +34,7 @@ class CustomFunctions extends AbstractExtension {
{
return Config::get('app.publicDirectory');
}
public function getConfigValue(string $key)
{
return Config::get($key);
......@@ -58,4 +60,13 @@ class CustomFunctions extends AbstractExtension {
return date('Y');
}
public function getUser()
{
if (User::hasAuthenticatedUser()) {
return User::getCurrentUser();
}
return null;
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment