Skip to content

Commit

Permalink
Laravel 10
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronNeonDigital committed Apr 19, 2024
1 parent 8f63e23 commit 6efda0e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
}
],
"require": {
"php": ">=5.4.0",
"illuminate/support": ">=4.0.0"
"php": "^8.1",
"illuminate/support": ">=10.0.0"
},
"autoload": {
"psr-0": {
Expand Down
20 changes: 12 additions & 8 deletions src/Forma/Helpers.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
<?php namespace Forma;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Lang;
use Illuminate\Support\Facades\URL;

class Helpers
{

public static function url($string)
{
if (static::isLaravel())
{
return \URL::to($string);
return (new URL())->to($string);
}

return $string;
}

public static function hasLang($string)
public static function hasLang($string): bool
{
if (static::isLaravel())
{
return \Lang::has($string);
return (new Lang)->has($string);
}

return false;
Expand All @@ -27,7 +31,7 @@ public static function lang($string)
{
if (static::isLaravel())
{
return \Lang::get($string);
return (new Lang)->get($string);
}

return $string;
Expand All @@ -37,23 +41,23 @@ public static function input($string)
{
if (static::isLaravel())
{
return \Request::get($string);
return (new Request)->get($string);
}

return isset($_REQUEST[$string]) ? $_REQUEST[$string] : false;
return $_REQUEST[$string] ?? false;
}

public static function inputOld($string)
{
if (static::isLaravel())
{
return \Request::old($string);
return (new Request)->old($string);
}

return false;
}

public static function isLaravel()
public static function isLaravel(): bool
{
return class_exists('Illuminate\Foundation\Application');
}
Expand Down

0 comments on commit 6efda0e

Please sign in to comment.