Skip to content

Commit

Permalink
Laravel 11 + PHP 8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony BOTALLA committed Jul 10, 2024
1 parent 67481b6 commit d34ddd8
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 14 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Novius CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
lint-php:

runs-on: ubuntu-latest

steps:
- uses: shivammathur/setup-php@v2
with:
php-versions: '8.3'

- name: Checkout code
uses: actions/checkout@v3

- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: vendor
key: composer-${{ hashFiles('composer.lock') }}

- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

- name: Lint PHP code via Laravel Pint
run: composer run-script lint
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ This package allows you to manage Laravel Models which use [Laravel Translatable
## Requirements

* Laravel Nova >= 4.0
* Laravel Translatable >= 0.0.1
* Laravel >= 8.0
* Laravel >= 10.0
* PHP >= 8.2

> **NOTE**: These instructions are for Laravel >= 10.0 and PHP >= 8.2 If you are using prior version, please
> see the [previous version's docs](https://github.com/novius/laravel-nova-translatable/tree/0.x).

## Installation

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
}
],
"require": {
"php": "^8.1",
"illuminate/support": "^8.83.4|^9.3.1|^10.0",
"php": ">=8.2",
"illuminate/support": "^10.0|^11.0",
"laravel/nova": "^4.0",
"novius/laravel-translatable": "^0.0.5"
"novius/laravel-translatable": "^1.0"
},
"require-dev": {
"laravel/pint": "^1.10"
Expand Down
8 changes: 4 additions & 4 deletions src/Helpers/SessionHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class SessionHelper
{
protected static function sessionKey(string $resource = null): string
protected static function sessionKey(?string $resource = null): string
{
if ($resource !== null) {
return 'laravel_nova_translatable_'.$resource.'_current_locale';
Expand All @@ -13,17 +13,17 @@ protected static function sessionKey(string $resource = null): string
return 'laravel_nova_translatable_current_locale';
}

public static function currentLocale(string $resource = null): ?string
public static function currentLocale(?string $resource = null): ?string
{
return session()->get(static::sessionKey($resource));
}

public static function clearCurrentLocale(string $resource = null): void
public static function clearCurrentLocale(?string $resource = null): void
{
session()->forget(static::sessionKey($resource));
}

public static function setCurrentLocale(string $locale, string $resource = null): void
public static function setCurrentLocale(string $locale, ?string $resource = null): void
{
session()->put(static::sessionKey($resource), $locale);
}
Expand Down
4 changes: 1 addition & 3 deletions src/LaravelNovaTranslatableServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@

class LaravelNovaTranslatableServiceProvider extends ServiceProvider
{
public function register(): void
{
}
public function register(): void {}

/**
* Bootstrap services.
Expand Down
2 changes: 1 addition & 1 deletion src/Nova/Fields/Locale.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Locale extends Select

public $copyable = false;

public function __construct($name = null, $attribute = null, callable $resolveCallback = null)
public function __construct($name = null, $attribute = null, ?callable $resolveCallback = null)
{
$name = $name ?? trans('laravel-nova-translatable::messages.language');

Expand Down
2 changes: 1 addition & 1 deletion src/Nova/Fields/Translations.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Translations extends Text

public bool $withoutMissing = false;

public function __construct($name = null, $attribute = null, callable $resolveCallback = null)
public function __construct($name = null, $attribute = null, ?callable $resolveCallback = null)
{
$name = $name ?? trans('laravel-nova-translatable::messages.translations');

Expand Down

0 comments on commit d34ddd8

Please sign in to comment.