Skip to content

Commit

Permalink
Merge pull request #164 from troccoli/upgrade-to-laravel-8
Browse files Browse the repository at this point in the history
Upgraded to Laravel 8
  • Loading branch information
troccoli authored Jul 13, 2021
2 parents 16d61ab + 386e418 commit 65878ef
Show file tree
Hide file tree
Showing 155 changed files with 14,099 additions and 14,748 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- composer-v2-
- run:
name: Install Composer Dependencies
command: composer install -n --ignore-platform-reqs --no-progress --no-suggest
command: composer install -n --ignore-platform-reqs --no-progress
- save_cache:
key: composer-v2-{{ checksum "composer.lock" }}
paths:
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:

- run:
name: Run Unit Tests
command: vendor/bin/phpunit --printer PHPUnit\\TextUI\\ResultPrinter
command: vendor/bin/phpunit

- run:
name: Update Chrome Driver
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jobs:
- name: Dump Autoloader
run: composer dump-autoload
- name: Execute Unit tests via PHPUnit
run: vendor/bin/phpunit tests/Unit --printer PHPUnit\\TextUI\\ResultPrinter
run: vendor/bin/phpunit tests/Unit
- name: Upload artifacts
uses: actions/upload-artifact@v2
if: failure()
Expand Down Expand Up @@ -148,7 +148,7 @@ jobs:
- name: Run Laravel Server
run: php artisan serve &
- name: Execute Integration tests via PHPUnit
run: vendor/bin/phpunit tests/Integration --printer PHPUnit\\TextUI\\ResultPrinter
run: vendor/bin/phpunit tests/Integration
- name: Upload artifacts
uses: actions/upload-artifact@v2
if: failure()
Expand Down Expand Up @@ -201,7 +201,7 @@ jobs:
- name: Run Laravel Server
run: php artisan serve &
- name: Execute Feature tests via PHPUnit
run: vendor/bin/phpunit tests/Feature --printer PHPUnit\\TextUI\\ResultPrinter
run: vendor/bin/phpunit tests/Feature
- name: Upload artifacts
uses: actions/upload-artifact@v2
if: failure()
Expand Down
2 changes: 1 addition & 1 deletion .styleci.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
preset: psr2
preset: laravel
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ branches:

install:
- cp .env.ci .env
- travis_retry composer install -n --ignore-platform-reqs --no-progress --no-suggest
- travis_retry composer install -n --ignore-platform-reqs --no-progress
- npm install
- npm run production

Expand All @@ -30,7 +30,7 @@ before_script:
- php artisan serve &

script:
- vendor/bin/phpunit --printer PHPUnit\\TextUI\\ResultPrinter
- vendor/bin/phpunit
- php artisan dusk

notifications:
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace App\Exceptions;

use Throwable;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;

class Handler extends ExceptionHandler
{
Expand Down
4 changes: 2 additions & 2 deletions app/Helpers/PermissionsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class PermissionsHelper
{
final public static function addSeason(): string
{
return "add-season";
return 'add-season';
}

final public static function viewSeason(Season $season): string
Expand Down Expand Up @@ -92,7 +92,7 @@ final public static function deleteFixtures(Division $division): string

final public static function addClub(): string
{
return "add-club";
return 'add-club';
}

final public static function viewClub(Club $club): string
Expand Down
12 changes: 6 additions & 6 deletions app/Helpers/RolesHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final public static function seasonAdmin(Season $season): string

final public static function isSeasonAdmin(Role $role): bool
{
return (bool)preg_match(self::buildPattern(self::SEASON_ADMIN_TEMPLATE), $role->name);
return (bool) preg_match(self::buildPattern(self::SEASON_ADMIN_TEMPLATE), $role->name);
}

final public static function findSeason(Role $role): ?Season
Expand All @@ -47,7 +47,7 @@ final public static function competitionAdmin(Competition $competition): string

final public static function isCompetitionAdmin(Role $role): bool
{
return (bool)preg_match(self::buildPattern(self::COMPETITION_ADMIN_TEMPLATE), $role->name);
return (bool) preg_match(self::buildPattern(self::COMPETITION_ADMIN_TEMPLATE), $role->name);
}

final public static function findCompetition(Role $role): ?Competition
Expand All @@ -66,7 +66,7 @@ final public static function divisionAdmin(Division $competition): string

final public static function isDivisionAdmin(Role $role): bool
{
return (bool)preg_match(self::buildPattern(self::DIVISION_ADMIN_TEMPLATE), $role->name);
return (bool) preg_match(self::buildPattern(self::DIVISION_ADMIN_TEMPLATE), $role->name);
}

final public static function findDivision(Role $role): ?Division
Expand All @@ -85,7 +85,7 @@ final public static function clubSecretary(Club $club): string

final public static function isClubSecretary(Role $role): bool
{
return (bool)preg_match(self::buildPattern(self::CLUB_SECRETARY_TEMPLATE), $role->name);
return (bool) preg_match(self::buildPattern(self::CLUB_SECRETARY_TEMPLATE), $role->name);
}

final public static function findClub(Role $role): ?Club
Expand All @@ -104,7 +104,7 @@ final public static function teamSecretary(Team $team): string

final public static function isTeamSecretary(Role $role): bool
{
return (bool)preg_match(self::buildPattern(self::TEAM_SECRETARY_TEMPLATE), $role->name);
return (bool) preg_match(self::buildPattern(self::TEAM_SECRETARY_TEMPLATE), $role->name);
}

final public static function findTeam(Role $role): ?Team
Expand All @@ -118,6 +118,6 @@ final public static function findTeam(Role $role): ?Team

final private static function buildPattern(string $template): string
{
return '/^' . Str::replaceFirst('%s', '(\d+)', $template) . '$/';
return '/^'.Str::replaceFirst('%s', '(\d+)', $template).'$/';
}
}
4 changes: 2 additions & 2 deletions app/Http/Controllers/Auth/RegisterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace App\Http\Controllers\Auth;

use App\Models\User;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Illuminate\Foundation\Auth\RegistersUsers;

class RegisterController extends Controller
{
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/ClubController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function store(Request $request): RedirectResponse
$request,
[
'name' => 'required|unique:clubs',
'venue_id' => 'present|nullable|exists:venues,id'
'venue_id' => 'present|nullable|exists:venues,id',
],
[
'name.required' => __('The name is required.'),
Expand All @@ -60,7 +60,7 @@ public function update(Request $request, Club $club): RedirectResponse
$this->validate(
$request,
[
'name' => 'required|unique:clubs,name,' . $club->getId(),
'name' => 'required|unique:clubs,name,'.$club->getId(),
'venue_id' => 'present|nullable|exists:venues,id',
],
[
Expand Down
1 change: 0 additions & 1 deletion app/Http/Controllers/CompetitionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Illuminate\Database\Query\Builder;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Validation\Rule;
use Illuminate\View\View;

Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Routing\Controller as BaseController;

class Controller extends BaseController
{
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/SeasonController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function store(Request $request): RedirectResponse

Season::create($request->only('year'));

return redirect()->route('seasons.index') ->withToastSuccess(__('Season added!'));
return redirect()->route('seasons.index')->withToastSuccess(__('Season added!'));
}

public function edit(Season $season): View
Expand All @@ -53,7 +53,7 @@ public function update(Request $request, Season $season): RedirectResponse
$this->validate(
$request,
[
'year' => 'required|integer|unique:seasons,year,' . $season->getId(),
'year' => 'required|integer|unique:seasons,year,'.$season->getId(),
],
[
'year.required' => __('The year is required.'),
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/TeamController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace App\Http\Controllers;

use App\Models\Team;
use App\Models\Club;
use App\Models\Team;
use App\Models\Venue;
use Illuminate\Database\Query\Builder;
use Illuminate\Http\RedirectResponse;
Expand Down Expand Up @@ -45,7 +45,7 @@ public function store(Request $request, Club $club): RedirectResponse
return $query->where('club_id', $club->getId());
}),
],
'venue_id' => 'present|nullable|exists:venues,id'
'venue_id' => 'present|nullable|exists:venues,id',
],
[
'name.required' => __('The name is required.'),
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/VenueController.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function update(Request $request, Venue $venue): RedirectResponse
$this->validate(
$request,
[
'name' => 'required|unique:venues,name,' . $venue->getId(),
'name' => 'required|unique:venues,name,'.$venue->getId(),
],
[
'name.required' => __('The name is required.'),
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Middleware/TrustProxies.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace App\Http\Middleware;

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

class TrustProxies extends Middleware
{
Expand Down
1 change: 0 additions & 1 deletion app/Http/Resources/TeamResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use App\Http\Controllers\Api\V1\LoadRelations;
use App\Models\Team;
use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Http\Resources\MissingValue;

class TeamResource extends JsonResource
{
Expand Down
7 changes: 5 additions & 2 deletions app/Models/Club.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@

use App\Events\ClubCreated;
use Illuminate\Database\Eloquent\Collection as EloquentCollection;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Collection;

class Club extends Model
{
use HasFactory;

protected $fillable = ['name', 'venue_id'];

protected $dispatchesEvents = [
Expand Down Expand Up @@ -42,12 +45,12 @@ public function venue(): BelongsTo
return $this->belongsTo(Venue::class);
}

public function getVenue():? Venue
public function getVenue(): ?Venue
{
return $this->venue;
}

public function getVenueId():? string
public function getVenueId(): ?string
{
return $this->venue_id;
}
Expand Down
3 changes: 3 additions & 0 deletions app/Models/Competition.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
use App\Events\CompetitionCreated;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection as EloquentCollection;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasManyThrough;

class Competition extends Model
{
use HasFactory;

protected $fillable = ['season_id', 'name'];

protected $dispatchesEvents = [
Expand Down
3 changes: 2 additions & 1 deletion app/Models/Division.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace App\Models;

use App\Events\DivisionCreated;
use App\Events\SeasonCreated;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
Expand All @@ -14,6 +14,7 @@

class Division extends Model
{
use HasFactory;
use SoftDeletes;

protected $fillable = ['competition_id', 'name', 'display_order'];
Expand Down
3 changes: 2 additions & 1 deletion app/Models/Fixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\SoftDeletes;

class Fixture extends Model
{
use HasFactory;
use SoftDeletes;

protected $guarded = ['id', 'created_at', 'updated_at', 'deleted_at'];
Expand Down
3 changes: 3 additions & 0 deletions app/Models/Season.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
use App\Events\SeasonCreated;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection as EloquentCollection;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Collection;

class Season extends Model
{
use HasFactory;

protected $fillable = ['year'];

protected $dispatchesEvents = [
Expand Down
Loading

0 comments on commit 65878ef

Please sign in to comment.