diff --git a/composer.json b/composer.json index 4d87ee6..cfebe43 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ ] }, "require": { - "php": "^7.3", + "php": "^7.4|^8.0", "radiate/framework": "^2.0" }, "scripts": { diff --git a/functions.php b/functions.php index f282c77..d048620 100644 --- a/functions.php +++ b/functions.php @@ -101,14 +101,17 @@ 'Cache' => \Radiate\Support\Facades\Cache::class, 'Collection' => \Radiate\Support\Collection::class, 'Config' => \Radiate\Support\Facades\Config::class, + 'Crypt' => \Radiate\Support\Facades\Crypt::class, 'DB' => \Radiate\Support\Facades\DB::class, 'Event' => \Radiate\Support\Facades\Event::class, 'File' => \Radiate\Support\Facades\File::class, - 'Hash' => \Radiate\Support\Hash::class, + 'Gate' => \Radiate\Support\Facades\Gate::class, + 'Hash' => \Radiate\Support\Facades\Hash::class, 'Http' => \Radiate\Support\Facades\Http::class, 'Mail' => \Radiate\Support\Facades\Mail::class, 'Option' => \Radiate\Support\Facades\Option::class, 'Request' => \Radiate\Support\Facades\Request::class, + 'Response' => \Radiate\Support\Facades\Response::class, 'Route' => \Radiate\Support\Facades\Route::class, 'Str' => \Radiate\Support\Str::class, 'URL' => \Radiate\Support\Facades\URL::class, diff --git a/helpers.php b/helpers.php index 6c98e3b..c5e4b59 100644 --- a/helpers.php +++ b/helpers.php @@ -1,6 +1,26 @@ make($abstract, $parameters); + } +} if (!function_exists('base_path')) { /** @@ -11,7 +31,7 @@ */ function base_path(?string $path = null) { - return App::basePath($path); + return app()->basePath($path); } } @@ -36,3 +56,44 @@ function env(string $key, $default = null) return $default; } } + +if (!function_exists('response')) { + /** + * Create a HTTP response + * + * @param mixed $content + * @param integer $status + * @param array $headers + * @return \Radiate\Http\ResponseFactory|\Radiate\Http\Response + */ + function response($content = '', int $status = 200, array $headers = []) + { + $factory = app(ResponseFactory::class); + + if (func_num_args() === 0) { + return $factory; + } + + return $factory->make($content, $status, $headers); + } +} + +if (!function_exists('view')) { + /** + * Create a view + * + * @param string|null $view + * @param array $data + * @return \Radiate\View\Factory|\Radiate\View\View + */ + function view(?string $view = null, array $data = []) + { + $factory = app(ViewFactory::class); + + if (func_num_args() === 0) { + return $factory; + } + + return $factory->make($view, $data); + } +}