Skip to content

Commit

Permalink
release: 4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
andyksaw authored Aug 23, 2024
2 parents 82d36cf + 3038b08 commit d7e45c5
Show file tree
Hide file tree
Showing 598 changed files with 9,420 additions and 12,409 deletions.
10 changes: 0 additions & 10 deletions .codecov.yml

This file was deleted.

9 changes: 5 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ STRIPE_SECRET=
STRIPE_WEBHOOK_SECRET=
CASHIER_CURRENCY=usd

DB_CONNECTION=mysql
DB_CONNECTION=mariadb
DB_HOST=mariadb
DB_PORT=3306
DB_DATABASE=default
DB_USERNAME=default
DB_PASSWORD=secret
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=
DB_COLLATION=utf8mb4_unicode_ci

BROADCAST_DRIVER=log
CACHE_DRIVER=file
Expand Down
33 changes: 0 additions & 33 deletions .github/workflows/bump-version.yml

This file was deleted.

36 changes: 0 additions & 36 deletions .github/workflows/lint.yml

This file was deleted.

28 changes: 0 additions & 28 deletions .github/workflows/open-release-pr.yml

This file was deleted.

44 changes: 27 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,39 @@
name: Unit Tests

on: push
on:
push:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
unit-test:
runs-on: ubuntu-latest

services:
mariadb:
image: mariadb:10.3
image: mariadb:11.0.5
env:
MYSQL_DATABASE: testing
MYSQL_USER: root
MYSQL_ROOT_PASSWORD: root
MARIADB_DATABASE: testing
MARIADB_USER: user
MARIADB_PASSWORD: password
MARIADB_ROOT_PASSWORD: password
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=5s --health-retries=3
options: >-
--health-cmd="healthcheck.sh --connect --innodb_initialized"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
php-version: 8.3
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite
coverage: none

Expand Down Expand Up @@ -87,22 +97,22 @@ jobs:
if: steps.assets-cache.outputs.cache-hit != 'true'
run: npm run build

- name: Prepare .env file
run: |
cp .env.example .env
echo "DB_HOST=127.0.0.1" >> .env
echo "DB_USERNAME=root" >> .env
echo "DB_PASSWORD=password" >> .env
- name: Prepare Laravel
run: |
php artisan key:generate
chmod -R 777 storage bootstrap/cache
chmod -R 755 storage bootstrap/cache
- name: Prepare database
env:
DB_HOST: 127.0.0.1
MYSQL_USER: root
MYSQL_ROOT_PASSWORD: root
run: php artisan migrate

- name: Larastan
run: ./vendor/bin/phpstan analyse

- name: PHPUnit
- name: Run tests
env:
DB_HOST: 127.0.0.1
MYSQL_USER: root
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
The official repository for [Project City Build](https://projectcitybuild.com)'s homepage and related web services.

### Stack
* Frameworks: Laravel 9, Vue 3
* Frameworks: Laravel 11, Vue 3
* Environment: Laravel Sail (Docker)
* CI/CD: GitHub Actions

All branches, commits and pull-requests are continuously tested

### Requirements

The only requirement is [Docker](https://docs.docker.com/get-docker/), as we use Laravel Sail to boot up a development environment.
[Docker](https://docs.docker.com/get-docker/) is required to run the development environment via Laravel Sail.

## Can I contribute?

Expand Down
97 changes: 55 additions & 42 deletions app/Providers/AppServiceProvider.php → app/AppServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,33 +1,38 @@
<?php

namespace App\Providers;
namespace App;

use App\Core\Domains\PlayerLookup\Service\ConcretePlayerLookup;
use App\Core\Domains\PlayerLookup\Service\PlayerLookup;
use App\Http\Controllers\Api\v1\OAuthController;
use App\Models\Account;
use App\Models\BalanceTransaction;
use App\Models\Badge;
use App\Models\BanAppeal;
use App\Models\BuilderRankApplication;
use App\Models\Donation;
use App\Models\DonationPerk;
use App\Models\DonationTier;
use App\Models\GameIPBan;
use App\Models\GamePlayerBan;
use App\Models\MinecraftPlayer;
use App\Models\Page;
use App\Models\PlayerWarning;
use App\Models\Server;
use App\Models\ServerToken;
use App\View\Components\DonationBarComponent;
use App\View\Components\NavBarComponent;
use App\View\Components\PanelSideBarComponent;
use Entities\Models\Eloquent\Account;
use Entities\Models\Eloquent\AccountBalanceTransaction;
use Entities\Models\Eloquent\Badge;
use Entities\Models\Eloquent\BanAppeal;
use Entities\Models\Eloquent\BuilderRankApplication;
use Entities\Models\Eloquent\Donation;
use Entities\Models\Eloquent\DonationPerk;
use Entities\Models\Eloquent\DonationTier;
use Entities\Models\Eloquent\GameIPBan;
use Entities\Models\Eloquent\GamePlayerBan;
use Entities\Models\Eloquent\MinecraftPlayer;
use Entities\Models\Eloquent\Page;
use Entities\Models\Eloquent\PlayerWarning;
use Entities\Models\Eloquent\Server;
use Entities\Models\Eloquent\ServerToken;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\ServiceProvider;
use Laravel\Cashier\Cashier;
use Shared\PlayerLookup\Service\ConcretePlayerLookup;
use Shared\PlayerLookup\Service\PlayerLookup;
use Repositories\GameIPBans\GameIPBanEloquentRepository;
use Repositories\GameIPBans\GameIPBanRepository;
use Repositories\PlayerWarnings\PlayerWarningEloquentRepository;
use Repositories\PlayerWarnings\PlayerWarningRepository;
use Stripe\StripeClient;

final class AppServiceProvider extends ServiceProvider
Expand All @@ -42,14 +47,18 @@ public function register()
$this->app->bind(StripeClient::class, function ($app) {
return new StripeClient(config('services.stripe.secret'));
});

$this->app->bind(
abstract: PlayerLookup::class,
concrete: ConcretePlayerLookup::class,
);

// Prevent Cashier's vendor migrations running because we override them
Cashier::ignoreMigrations();
$this->app->bind(
abstract: GameIPBanRepository::class,
concrete: GameIPBanEloquentRepository::class,
);
$this->app->bind(
abstract: PlayerWarningRepository::class,
concrete: PlayerWarningEloquentRepository::class,
);
}

/**
Expand All @@ -59,24 +68,34 @@ public function register()
*/
public function boot()
{
Schema::defaultStringLength(191);
$this->enforceMorphMap();

Cashier::useCustomerModel(Account::class);
$this->bindBladeComponents();

// Set a default date format for displaying Carbon instances in views
Blade::stringable(function (\Illuminate\Support\Carbon $dateTime) {
return $dateTime->format('j M Y H:i');
});

RateLimiter::for('login', function (Request $request) {
return Limit::perMinute(6)->by($request->ip());
});
}

private function enforceMorphMap(): void
{
/**
* Enforce that models are mapped to a key.
*
* Without mapping, Laravel attempts to store the full namespace
* path to a model in the database, which is easy to break if we
* rename namespaces, move files, etc. Instead we'll store a 'key'
* mapped to the model.
* Laravel stores the full namespace of models in the database by default. This is easily susceptible to
* breakage, so instead we'll force that they be mapped to keys instead.
*
* @see https://github.com/laravel/framework/pull/38656
*/
Relation::enforceMorphMap([
'account' => Account::class,
'badge' => Badge::class,
'balance_transaction' => AccountBalanceTransaction::class,
'balance_transaction' => BalanceTransaction::class,
'ban_appeal' => BanAppeal::class,
'builder_rank_application' => BuilderRankApplication::class,
'donation' => Donation::class,
Expand All @@ -90,20 +109,14 @@ public function boot()
'server_token' => ServerToken::class,
'player_warning' => PlayerWarning::class,
]);
}

private function bindBladeComponents(): void
{
Blade::component('navbar', NavBarComponent::class);
Blade::component('donation-bar', DonationBarComponent::class);
Blade::component('panel-side-bar', PanelSideBarComponent::class);
Blade::anonymousComponentNamespace('admin.activity.components', 'activity');

// Fix the factory() function always searching for factory files with a relative namespace
Factory::guessFactoryNamesUsing(function (string $modelName) {
return 'Database\Factories\\'.class_basename($modelName).'Factory';
});

// Set a default date format for displaying Carbon instances in views
Blade::stringable(function (\Illuminate\Support\Carbon $dateTime) {
return $dateTime->format('j M Y H:i');
});
Blade::anonymousComponentNamespace('admin.activity.components', 'activity');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Console\Commands;

use Domain\PasswordReset\UseCases\DeleteExpiredPasswordResets;
use App\Domains\PasswordReset\UseCases\DeleteExpiredPasswordResets;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;

Expand Down
Loading

0 comments on commit d7e45c5

Please sign in to comment.