2017-09-03 02:35:33 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Traits\Controllers;
|
|
|
|
|
2017-10-19 03:32:19 +00:00
|
|
|
use Illuminate\Http\Request;
|
2017-09-03 02:35:33 +00:00
|
|
|
|
2017-09-03 21:32:52 +00:00
|
|
|
trait JavascriptInjection
|
2017-09-03 02:35:33 +00:00
|
|
|
{
|
2022-10-14 16:59:20 +00:00
|
|
|
private Request $request;
|
2017-10-21 02:32:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the request object to use when injecting JS.
|
|
|
|
*/
|
2022-10-14 16:59:20 +00:00
|
|
|
public function setRequest(Request $request): self
|
2017-10-21 02:32:57 +00:00
|
|
|
{
|
|
|
|
$this->request = $request;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2019-11-24 20:50:16 +00:00
|
|
|
/**
|
|
|
|
* Injects the exact array passed in, nothing more.
|
|
|
|
*/
|
2022-10-14 16:59:20 +00:00
|
|
|
public function plainInject(array $args = []): string
|
2019-11-24 20:50:16 +00:00
|
|
|
{
|
2023-02-23 19:30:16 +00:00
|
|
|
return \JavaScript::put($args);
|
2019-11-24 20:50:16 +00:00
|
|
|
}
|
2017-09-03 02:35:33 +00:00
|
|
|
}
|