You've already forked pilot-sdk
add iframe action
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Bluesquare\Pilot\Entity;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
abstract class Action extends Entity
|
||||
{
|
||||
public function action(
|
||||
@@ -30,6 +32,23 @@ abstract class Action extends Entity
|
||||
];
|
||||
}
|
||||
|
||||
public function iframe($url, $expires = 240)
|
||||
{
|
||||
$key = 'pilot_action_' . Str::random(10);
|
||||
$token = Str::random(40);
|
||||
|
||||
cache()->add($key, $token, now()->addMinutes($expires));
|
||||
|
||||
$url = $url . (str_contains($url, '?') ? '&' : '?') . "pilot_token=$key|$token";
|
||||
|
||||
return [
|
||||
'json' => [
|
||||
'type' => 'iframe',
|
||||
'url' => $url,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function error($message)
|
||||
{
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user