Skip to content

Commit

Permalink
Merge pull request #206 from SlovakNationalGallery/upgrade-laravel-an…
Browse files Browse the repository at this point in the history
…d-backpack

Upgrade laravel and backpack
  • Loading branch information
igor-kamil authored Feb 8, 2024
2 parents faf3f68 + 6aad136 commit 5353591
Show file tree
Hide file tree
Showing 46 changed files with 5,163 additions and 4,412 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ jobs:
${{ runner.os }}-node-
- uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.2
extensions: mbstring, bcmath, fileinfo, pdo_mysql
- name: Add Composer auth credentials (for Backpack Pro)
run: echo '${{ secrets.COMPOSER_AUTH_JSON }}' > $GITHUB_WORKSPACE/auth.json
- run: composer install --no-progress --no-interaction
- uses: actions/setup-node@v2
with:
Expand Down Expand Up @@ -75,7 +77,9 @@ jobs:
${{ runner.os }}-composer-
- uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.2
- name: Add Composer auth credentials (for Backpack Pro)
run: echo '${{ secrets.COMPOSER_AUTH_JSON }}' > $GITHUB_WORKSPACE/auth.json
- run: composer install --no-progress --no-interaction --no-dev
- uses: atymic/deployer-php-action@0.2.0
with:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/.phpunit.cache
/node_modules
/public/hot
/public/storage
Expand All @@ -16,3 +17,5 @@ Homestead.yaml
npm-debug.log
yarn-error.log
mix-manifest.json
auth.json
/public/packages
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ installs as well as long as you configure them equivalently (see

- docker
- docker-compose
- php 7.4
- composer (tested with `Composer version 1.10.16 2020-10-24 09:55`)
- node 12.13 or higher
- php 8.2
- composer 2
- node 14 (or higher)

## First time setup

Expand All @@ -41,6 +41,12 @@ installs as well as long as you configure them equivalently (see

## Development

For Backpack Pro to work, don't forget to

- Create auth.json with credentials to `backpack/pro` repository. See auth.json.example

Additionaly

- Run `docker-compose up` to start network services
- Run `npm run dev` to build frontend assets
- Run `php artisan serve` to start php development server
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Kernel extends HttpKernel
protected $middleware = [
// \App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class,
\Fruitcake\Cors\HandleCors::class,
\Illuminate\Http\Middleware\HandleCors::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
Expand Down
13 changes: 9 additions & 4 deletions app/Http/Middleware/TrustProxies.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

namespace App\Http\Middleware;

use Fideloper\Proxy\TrustProxies as Middleware;
use Illuminate\Http\Middleware\TrustProxies as Middleware;
use Illuminate\Http\Request;

class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array|string|null
* @var array<int, string>|string|null
*/
protected $proxies;

Expand All @@ -19,5 +19,10 @@ class TrustProxies extends Middleware
*
* @var int
*/
protected $headers = Request::HEADER_X_FORWARDED_ALL;
}
protected $headers =
Request::HEADER_X_FORWARDED_FOR |
Request::HEADER_X_FORWARDED_HOST |
Request::HEADER_X_FORWARDED_PORT |
Request::HEADER_X_FORWARDED_PROTO |
Request::HEADER_X_FORWARDED_AWS_ELB;
}
14 changes: 7 additions & 7 deletions app/Models/Contest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ class Contest extends Model implements HasMedia

public $incrementing = false;

protected $dates = [
'announced_at',
'approved_at',
'finished_at',
'results_published_at',
'created_at',
'updated_at',
protected $casts = [
'announced_at' => 'datetime',
'approved_at' => 'datetime',
'finished_at' => 'datetime',
'results_published_at' => 'datetime',
'created_at' => 'datetime',
'updated_at' => 'datetime',
];

protected $appends = ['state'];
Expand Down
7 changes: 6 additions & 1 deletion app/Models/Deadline.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ class Deadline extends Model

protected $table = 'deadlines';
protected $guarded = ['id'];
protected $dates = ['published_at', 'deadline_at'];
protected $translatable = ['title'];

protected $casts = [
'published_at' => 'datetime',
'deadline_at' => 'datetime',
];


/*
|--------------------------------------------------------------------------
| SCOPES
Expand Down
1 change: 0 additions & 1 deletion app/Models/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class Document extends Model implements HasMedia
];

protected $hidden = [];
// protected $dates = [];

public $with = ['types', 'topics', 'roles'];

Expand Down
5 changes: 4 additions & 1 deletion app/Models/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ class Page extends Model implements HasMedia
'cover_image',
'redirect_url',
];
protected $dates = ['published_at'];

protected $casts = [
'published_at' => 'datetime',
];

public function getRouteKeyName()
{
Expand Down
3 changes: 2 additions & 1 deletion app/Models/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ class Post extends Model implements HasMedia
'is_featured',
'cover_image',
];
protected $dates = ['published_at'];

protected $casts = [
'is_featured' => 'boolean',
'published_at' => 'datetime',
];

public function getRouteKeyName()
Expand Down
5 changes: 4 additions & 1 deletion app/Models/Publication.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ class Publication extends Model

protected $table = 'publications';
protected $guarded = ['id'];
protected $dates = ['published_at'];
protected $translatable = ['title', 'description'];

protected $casts = [
'published_at' => 'datetime',
];

/*
|--------------------------------------------------------------------------
| FUNCTIONS
Expand Down
1 change: 0 additions & 1 deletion app/Models/Tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class Tag extends Model
protected $guarded = ['id'];
// protected $fillable = [];
// protected $hidden = [];
// protected $dates = [];

protected $translatable = [
'name',
Expand Down
5 changes: 4 additions & 1 deletion app/Models/Tile.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ class Tile extends Model

protected $table = 'tiles';
protected $guarded = ['id'];
protected $dates = ['published_at'];
protected $translatable = ['title'];

protected $casts = [
'published_at' => 'datetime',
];

/*
|--------------------------------------------------------------------------
| FUNCTIONS
Expand Down
11 changes: 11 additions & 0 deletions auth.json.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"http-basic": {
"backpackforlaravel.com": {
"username": "...",
"password": "..."
}
},
"github-oauth": {
"github.com": "ghp_..."
}
}
66 changes: 36 additions & 30 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,47 +8,50 @@
],
"license": "MIT",
"require": {
"php": "^7.3|^8.0",
"php": "^8.1",
"babenkoivan/elastic-migrations": "^1.3",
"babenkoivan/elastic-scout-driver": "^1.2",
"babenkoivan/elastic-scout-driver-plus": "^2.3",
"backpack/crud": "4.1.*",
"backpack/filemanager": "^1.1",
"backpack/logmanager": "^4.0",
"doctrine/dbal": "^2.5",
"fakerphp/faker": "^1.13",
"fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.12",
"laravel/scout": "^8.5",
"backpack/crud": "^6.0.0",
"backpack/filemanager": "^3.0",
"backpack/logmanager": "^5.0",
"backpack/pro": "^2.1",
"backpack/theme-coreuiv2": "^1.2",
"doctrine/dbal": "^3.5",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^10.10",
"laravel/sanctum": "^3.3",
"laravel/scout": "^9.0",
"laravel/telescope": "^4.3",
"laravel/tinker": "^2.5",
"laravel/ui": "^3.1",
"league/flysystem-sftp": "~1.0",
"lorisleiva/laravel-deployer": "^0.3.5",
"laravel/tinker": "^2.8",
"league/flysystem-sftp": "^3.0",
"mcamara/laravel-localization": "^1.6",
"sentry/sentry-laravel": "^3.3",
"spatie/laravel-medialibrary": "^9.4",
"spatie/laravel-medialibrary": "^11.0",
"spatie/laravel-missing-page-redirector": "^2.7",
"spatie/laravel-sluggable": "^2.6",
"spatie/laravel-tags": "^3.0",
"spatie/laravel-translatable": "^4.6",
"spatie/laravel-sluggable": "^3.5",
"spatie/laravel-tags": "^4.5",
"spatie/laravel-translatable": "^6.5",
"spatie/pdf-to-image": "^2.1",
"staudenmeir/eloquent-has-many-deep": "^1.13"
},
"require-dev": {
"backpack/generators": "^3.1",
"facade/ignition": "^2.5",
"mockery/mockery": "^1.4.2",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.3.3"
"backpack/generators": "^4.0",
"deployer/deployer": "^7.3",
"fakerphp/faker": "^1.9.1",
"laravel/pint": "^1.0",
"laravel/sail": "^1.18",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^7.0",
"phpunit/phpunit": "^10.1",
"spatie/laravel-ignition": "^2.0"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"php-http/discovery": true
}
},
Expand All @@ -69,13 +72,10 @@
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"minimum-stability": "stable",
"prefer-stable": true,
"scripts": {
"post-install-cmd": [
"@php artisan backpack:install",
"@php artisan elfinder:publish"
],
"post-install-cmd": ["@php artisan elfinder:publish"],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
Expand All @@ -86,5 +86,11 @@
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
}
},
"repositories": [
{
"type": "composer",
"url": "https://repo.backpackforlaravel.com"
}
]
}
Loading

0 comments on commit 5353591

Please sign in to comment.