style: make per the coding style in pint

This commit is contained in:
Rico van Zelst
2023-11-02 13:05:53 +01:00
parent a8c31e3097
commit 91ec747c2c
37 changed files with 55 additions and 69 deletions

View File

@@ -20,7 +20,7 @@ class Kernel extends ConsoleKernel
*/ */
protected function commands(): void protected function commands(): void
{ {
$this->load(__DIR__.'/Commands'); $this->load(__DIR__ . '/Commands');
require base_path('routes/console.php'); require base_path('routes/console.php');
} }

View File

@@ -8,5 +8,6 @@ use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController class Controller extends BaseController
{ {
use AuthorizesRequests, ValidatesRequests; use AuthorizesRequests;
use ValidatesRequests;
} }

View File

@@ -40,7 +40,7 @@ class Kernel extends HttpKernel
'api' => [ 'api' => [
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class, // \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
\Illuminate\Routing\Middleware\ThrottleRequests::class.':api', \Illuminate\Routing\Middleware\ThrottleRequests::class . ':api',
\Illuminate\Routing\Middleware\SubstituteBindings::class, \Illuminate\Routing\Middleware\SubstituteBindings::class,
], ],
]; ];

View File

@@ -47,46 +47,46 @@ class Champion extends Model
public function getChampionImageAttribute() public function getChampionImageAttribute()
{ {
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/splash-art'; return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/splash-art';
} }
public function getChampionImageLoadingAttribute() public function getChampionImageLoadingAttribute()
{ {
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/portrait'; return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/portrait';
} }
public function getChampionImageTileAttribute() public function getChampionImageTileAttribute()
{ {
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/tile'; return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/tile';
} }
public function getChampionSquareImageAttribute() public function getChampionSquareImageAttribute()
{ {
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/square'; return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/square';
} }
public function getChampionAbilityIconQAttribute() public function getChampionAbilityIconQAttribute()
{ {
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/ability-icon/q'; return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/ability-icon/q';
} }
public function getChampionAbilityIconWAttribute() public function getChampionAbilityIconWAttribute()
{ {
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/ability-icon/w'; return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/ability-icon/w';
} }
public function getChampionAbilityIconEAttribute() public function getChampionAbilityIconEAttribute()
{ {
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/ability-icon/e'; return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/ability-icon/e';
} }
public function getChampionAbilityIconRAttribute() public function getChampionAbilityIconRAttribute()
{ {
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/ability-icon/r'; return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/ability-icon/r';
} }
public function getChampionAbilityIconPAttribute() public function getChampionAbilityIconPAttribute()
{ {
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/ability-icon/p'; return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/ability-icon/p';
} }
} }

View File

@@ -59,16 +59,16 @@ class ChampionSkin extends Model
public function getSkinImageAttribute() public function getSkinImageAttribute()
{ {
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/splash-art/centered/skin/'.$this->skin_id; return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/splash-art/centered/skin/' . $this->skin_id;
} }
public function getSkinImageLoadingAttribute() public function getSkinImageLoadingAttribute()
{ {
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/portrait/skin/'.$this->skin_id; return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/portrait/skin/' . $this->skin_id;
} }
public function getSkinImageTileAttribute() public function getSkinImageTileAttribute()
{ {
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/tile/skin/'.$this->skin_id; return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/tile/skin/' . $this->skin_id;
} }
} }

View File

@@ -10,7 +10,9 @@ use Laravel\Sanctum\HasApiTokens;
class User extends Authenticatable class User extends Authenticatable
{ {
use HasApiTokens, HasFactory, Notifiable; use HasApiTokens;
use HasFactory;
use Notifiable;
/** /**
* The attributes that are mass assignable. * The attributes that are mass assignable.

View File

@@ -4,7 +4,6 @@ namespace App\Policies;
use App\Models\ChampionRoles; use App\Models\ChampionRoles;
use App\Models\User; use App\Models\User;
use Illuminate\Auth\Access\Response;
class ChampionRolesPolicy class ChampionRolesPolicy
{ {

View File

@@ -37,7 +37,7 @@ return [
'app_id' => env('PUSHER_APP_ID'), 'app_id' => env('PUSHER_APP_ID'),
'options' => [ 'options' => [
'cluster' => env('PUSHER_APP_CLUSTER'), 'cluster' => env('PUSHER_APP_CLUSTER'),
'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com', 'host' => env('PUSHER_HOST') ?: 'api-' . env('PUSHER_APP_CLUSTER', 'mt1') . '.pusher.com',
'port' => env('PUSHER_PORT', 443), 'port' => env('PUSHER_PORT', 443),
'scheme' => env('PUSHER_SCHEME', 'https'), 'scheme' => env('PUSHER_SCHEME', 'https'),
'encrypted' => true, 'encrypted' => true,

View File

@@ -106,6 +106,6 @@ return [
| |
*/ */
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'), 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_cache_'),
]; ];

View File

@@ -125,7 +125,7 @@ return [
'options' => [ 'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'), 'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_database_'),
], ],
'default' => [ 'default' => [

View File

@@ -39,7 +39,7 @@ return [
'public' => [ 'public' => [
'driver' => 'local', 'driver' => 'local',
'root' => storage_path('app/public'), 'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage', 'url' => env('APP_URL') . '/storage',
'visibility' => 'public', 'visibility' => 'public',
'throw' => false, 'throw' => false,
], ],

View File

@@ -89,7 +89,7 @@ return [
'handler_with' => [ 'handler_with' => [
'host' => env('PAPERTRAIL_URL'), 'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'), 'port' => env('PAPERTRAIL_PORT'),
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'), 'connectionString' => 'tls://' . env('PAPERTRAIL_URL') . ':' . env('PAPERTRAIL_PORT'),
], ],
'processors' => [PsrLogMessageProcessor::class], 'processors' => [PsrLogMessageProcessor::class],
], ],

View File

@@ -128,7 +128,7 @@ return [
'cookie' => env( 'cookie' => env(
'SESSION_COOKIE', 'SESSION_COOKIE',
Str::slug(env('APP_NAME', 'laravel'), '_').'_session' Str::slug(env('APP_NAME', 'laravel'), '_') . '_session'
), ),
/* /*

View File

@@ -26,7 +26,7 @@ class UserFactory extends Factory
*/ */
public function unverified(): static public function unverified(): static
{ {
return $this->state(fn (array $attributes) => [ return $this->state(fn(array $attributes) => [
'email_verified_at' => null, 'email_verified_at' => null,
]); ]);
} }

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class () extends Migration {
{
/** /**
* Run the migrations. * Run the migrations.
*/ */

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class () extends Migration {
{
/** /**
* Run the migrations. * Run the migrations.
*/ */

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class () extends Migration {
{
/** /**
* Run the migrations. * Run the migrations.
*/ */

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class () extends Migration {
{
/** /**
* Run the migrations. * Run the migrations.
*/ */

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class () extends Migration {
{
/** /**
* Run the migrations. * Run the migrations.
*/ */

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class () extends Migration {
{
/** /**
* Run the migrations. * Run the migrations.
*/ */

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class () extends Migration {
{
/** /**
* Run the migrations. * Run the migrations.
*/ */

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class () extends Migration {
{
/** /**
* Run the migrations. * Run the migrations.
*/ */

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class () extends Migration {
{
/** /**
* Run the migrations. * Run the migrations.
*/ */

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class () extends Migration {
{
/** /**
* Run the migrations. * Run the migrations.
*/ */

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class () extends Migration {
{
/** /**
* Run the migrations. * Run the migrations.
*/ */

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class () extends Migration {
{
/** /**
* Run the migrations. * Run the migrations.
*/ */

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class () extends Migration {
{
/** /**
* Run the migrations. * Run the migrations.
*/ */

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class () extends Migration {
{
/** /**
* Run the migrations. * Run the migrations.
*/ */

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class () extends Migration {
{
/** /**
* Run the migrations. * Run the migrations.
*/ */

View File

@@ -2,7 +2,6 @@
namespace Database\Seeders; namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
class ChampionRolesSeeder extends Seeder class ChampionRolesSeeder extends Seeder

View File

@@ -39,10 +39,10 @@ class ChampionSeeder extends Seeder
// Check if the champion already exists and if any attributes have changed, if so update the champion. If the champion doesn't exist, create it. // Check if the champion already exists and if any attributes have changed, if so update the champion. If the champion doesn't exist, create it.
// This is to prevent the champion data from being updated every time the seeder is run. As I'll probably run this on a cron job. // This is to prevent the champion data from being updated every time the seeder is run. As I'll probably run this on a cron job.
if ($championExists && $this->hasAttributesChanged($championExists, $championAttributes)) { if ($championExists && $this->hasAttributesChanged($championExists, $championAttributes)) {
Log::info('Champion '.$champion['name'].' has changed, updating...'); Log::info('Champion ' . $champion['name'] . ' has changed, updating...');
$championExists->update($championAttributes); $championExists->update($championAttributes);
} elseif (! $championExists) { } elseif (! $championExists) {
Log::info('New champion detected! Creating '.$champion['name'].'...'); Log::info('New champion detected! Creating ' . $champion['name'] . '...');
Champion::create($championAttributes); Champion::create($championAttributes);
} }
} }

View File

@@ -34,7 +34,7 @@ class ChampionSkinSeeder extends Seeder
'champion_id' => $champion['id'], 'champion_id' => $champion['id'],
'full_skin_id' => $skin['id'], 'full_skin_id' => $skin['id'],
'skin_id' => substr($skin['id'], 3), 'skin_id' => substr($skin['id'], 3),
'skin_name' => $skin['name'].' '.$champion['name'], 'skin_name' => $skin['name'] . ' ' . $champion['name'],
'lore' => $skin['lore'], 'lore' => $skin['lore'],
'availability' => $skin['availability'], 'availability' => $skin['availability'],
'loot_eligible' => $skin['lootEligible'], 'loot_eligible' => $skin['lootEligible'],
@@ -59,10 +59,10 @@ class ChampionSkinSeeder extends Seeder
// Check if the skin already exists and if any attributes have changed, if so update the skin. If the skin doesn't exist, create it. // Check if the skin already exists and if any attributes have changed, if so update the skin. If the skin doesn't exist, create it.
// This is to prevent the skin data from being updated every time the seeder is run. As I'll probably run this on a cron job. // This is to prevent the skin data from being updated every time the seeder is run. As I'll probably run this on a cron job.
if ($skinExists && $this->hasAttributesChanged($skinExists, $skinAttributes)) { if ($skinExists && $this->hasAttributesChanged($skinExists, $skinAttributes)) {
Log::info('Skin '.$skin['name'].' '.$champion['name'].' has changed, updating...'); Log::info('Skin ' . $skin['name'] . ' ' . $champion['name'] . ' has changed, updating...');
$skinExists->update($skinAttributes); $skinExists->update($skinAttributes);
} elseif (! $skinExists) { } elseif (! $skinExists) {
Log::info('New skin detected! Creating '.$skin['name'].' '.$champion['name'].'...'); Log::info('New skin detected! Creating ' . $skin['name'] . ' ' . $champion['name'] . '...');
ChampionSkin::create($skinAttributes); ChampionSkin::create($skinAttributes);
} }
} }

View File

@@ -17,6 +17,6 @@ class DatabaseSeeder extends Seeder
$this->call(ChampionSkinSeeder::class); $this->call(ChampionSkinSeeder::class);
$this->call(SkinChromaSeeder::class); $this->call(SkinChromaSeeder::class);
Log::info('Seeding complete at '.date('Y-m-d H:i:s')); Log::info('Seeding complete at ' . date('Y-m-d H:i:s'));
} }
} }

View File

@@ -32,7 +32,7 @@ class SkinChromaSeeder extends Seeder
$chromaAttributes = [ $chromaAttributes = [
'chroma_id' => $chromaId, 'chroma_id' => $chromaId,
'full_skin_id' => $skin['id'], 'full_skin_id' => $skin['id'],
'skin_name' => $skin['name'].' '.$champion['name'], 'skin_name' => $skin['name'] . ' ' . $champion['name'],
'chroma_name' => $chroma['name'], 'chroma_name' => $chroma['name'],
'chroma_colors' => $chroma['colors'], 'chroma_colors' => $chroma['colors'],
'chroma_image' => $chroma['chromaPath'], 'chroma_image' => $chroma['chromaPath'],
@@ -44,10 +44,10 @@ class SkinChromaSeeder extends Seeder
} }
if ($chromaExists && $this->hasAttributesChanged($chromaExists, $chromaAttributes)) { if ($chromaExists && $this->hasAttributesChanged($chromaExists, $chromaAttributes)) {
Log::info('Updating chroma: '.$chromaId); Log::info('Updating chroma: ' . $chromaId);
$chromaExists->update($chromaAttributes); $chromaExists->update($chromaAttributes);
} elseif (! $chromaExists) { } elseif (! $chromaExists) {
Log::info('Creating chroma: '.$chromaId); Log::info('Creating chroma: ' . $chromaId);
SkinChroma::create($chromaAttributes); SkinChroma::create($chromaAttributes);
} }
} }

View File

@@ -1,3 +1,3 @@
{ {
"preset": "laravel" "preset": "per"
} }

View File

@@ -16,7 +16,7 @@ define('LARAVEL_START', microtime(true));
| |
*/ */
if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) { if (file_exists($maintenance = __DIR__ . '/../storage/framework/maintenance.php')) {
require $maintenance; require $maintenance;
} }
@@ -31,7 +31,7 @@ if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php'))
| |
*/ */
require __DIR__.'/../vendor/autoload.php'; require __DIR__ . '/../vendor/autoload.php';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -44,7 +44,7 @@ require __DIR__.'/../vendor/autoload.php';
| |
*/ */
$app = require_once __DIR__.'/../bootstrap/app.php'; $app = require_once __DIR__ . '/../bootstrap/app.php';
$kernel = $app->make(Kernel::class); $kernel = $app->make(Kernel::class);

View File

@@ -12,7 +12,7 @@ trait CreatesApplication
*/ */
public function createApplication(): Application public function createApplication(): Application
{ {
$app = require __DIR__.'/../bootstrap/app.php'; $app = require __DIR__ . '/../bootstrap/app.php';
$app->make(Kernel::class)->bootstrap(); $app->make(Kernel::class)->bootstrap();