1 | <?php namespace GeneaLabs\LaravelMessenger; |
||
2 | |||
3 | use Jenssegers\Model\Model; |
||
4 | |||
5 | class Dripper extends Model |
||
6 | { |
||
7 | public function getUrlAttribute() : string |
||
8 | { |
||
9 | return trim(config('genealabs-laravel-caffeine.domain', url('/')), '/') |
||
10 | . '/' |
||
11 | . trim(config( |
||
12 | 'genealabs-laravel-caffeine.route', |
||
13 | 'genealabs/laravel-caffeine/drip' |
||
14 | ), '/'); |
||
15 | } |
||
16 | |||
17 | public function getIntervalAttribute() : string |
||
18 | { |
||
19 | return config( |
||
20 | 'genealabs-laravel-caffeine.dripIntervalInMilliSeconds', |
||
21 | 300000 |
||
22 | ); |
||
23 | } |
||
24 | |||
25 | public function getHtmlAttribute() : string |
||
26 | { |
||
27 | return '<script>setInterval(function(){' |
||
28 | . "var e=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject('Microsoft.XMLHTTP');" |
||
29 | . "e.open('GET','{$this->url}',!0);" |
||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
30 | . "e.setRequestHeader('X-Requested-With','XMLHttpRequest');" |
||
31 | . "e.send();}, {$this->interval});</script>"; |
||
0 ignored issues
–
show
The property
interval does not exist on GeneaLabs\LaravelMessenger\Dripper . Since you implemented __get , consider adding a @property annotation.
Loading history...
|
|||
32 | } |
||
33 | } |
||
34 |