generated from backstagephp/laravel-package-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelpers.php
More file actions
30 lines (25 loc) · 838 Bytes
/
helpers.php
File metadata and controls
30 lines (25 loc) · 838 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
if (! function_exists('geo')) {
function geo($attribute = '')
{
if (! session('geo')) {
$geo = json_decode(@file_get_contents('https://pro.ip-api.com/json/' . request()->ip() . '?key=' . config('services.ip-api.key')));
session()->put('geo', $geo);
} else {
$geo = session('geo');
}
return $attribute && isset($geo->{$attribute}) ? $geo->{$attribute} : null;
}
}
if (! function_exists('generate_password')) {
function generate_password(...$args)
{
return \Backstage\Laravel\Users\Domain\Password\Actions\GeneratePassword::run(...$args);
}
}
if (! function_exists('validate_email')) {
function validate_email(...$args)
{
return \Backstage\Laravel\Users\Domain\Email\Actions\ValidateEmail::run(...$args);
}
}