67 lines
1.1 KiB
PHP
67 lines
1.1 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Core\Facades;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* NovaCore Request Facade
|
||
|
|
* Static access to request services
|
||
|
|
*/
|
||
|
|
class Request
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Get request instance
|
||
|
|
*/
|
||
|
|
public static function instance(): \App\Core\Request
|
||
|
|
{
|
||
|
|
return app('request');
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get all input data
|
||
|
|
*/
|
||
|
|
public static function all(): array
|
||
|
|
{
|
||
|
|
return self::instance()->all();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get input value by key
|
||
|
|
*/
|
||
|
|
public static function input(string $key, $default = null)
|
||
|
|
{
|
||
|
|
return self::instance()->input($key, $default);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get request method
|
||
|
|
*/
|
||
|
|
public static function method(): string
|
||
|
|
{
|
||
|
|
return self::instance()->method();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get request URI
|
||
|
|
*/
|
||
|
|
public static function uri(): string
|
||
|
|
{
|
||
|
|
return self::instance()->uri();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Check if request is AJAX
|
||
|
|
*/
|
||
|
|
public static function isAjax(): bool
|
||
|
|
{
|
||
|
|
return self::instance()->isAjax();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Check if request expects JSON
|
||
|
|
*/
|
||
|
|
public static function expectsJson(): bool
|
||
|
|
{
|
||
|
|
return self::instance()->expectsJson();
|
||
|
|
}
|
||
|
|
}
|