🍺 Laravel Pint ran

- Moved the import statement for `Champion` and `ChampionSkin` models in their respective controllers to improve code organization.
- Refactored image attribute methods in the `Champion` model to use string interpolation for better readability.
- Refactored image attribute methods in the `ChampionSkin` model to use string interpolation for better readability.

This commit improves code organization and readability by refactoring import statements and using string interpolation for image attribute methods.
This commit is contained in:
Rico van Zelst
2023-10-27 01:23:39 +02:00
parent 3ee7112641
commit bb771faf25
13 changed files with 27 additions and 37 deletions

View File

@@ -2,9 +2,9 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Models\Champion;
use App\Http\Requests\StoreChampionRequest; use App\Http\Requests\StoreChampionRequest;
use App\Http\Requests\UpdateChampionRequest; use App\Http\Requests\UpdateChampionRequest;
use App\Models\Champion;
class ChampionController extends Controller class ChampionController extends Controller
{ {

View File

@@ -2,9 +2,9 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Models\ChampionSkin;
use App\Http\Requests\StoreChampionSkinRequest; use App\Http\Requests\StoreChampionSkinRequest;
use App\Http\Requests\UpdateChampionSkinRequest; use App\Http\Requests\UpdateChampionSkinRequest;
use App\Models\ChampionSkin;
class ChampionSkinController extends Controller class ChampionSkinController extends Controller
{ {

View File

@@ -36,46 +36,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

@@ -43,16 +43,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

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

View File

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

14
composer.lock generated
View File

@@ -7017,16 +7017,16 @@
}, },
{ {
"name": "laravel/pint", "name": "laravel/pint",
"version": "v1.13.3", "version": "v1.13.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/pint.git", "url": "https://github.com/laravel/pint.git",
"reference": "93b2d0d49719bc6e444ba21cd4dbbccec935413d" "reference": "df105cf8ce7a8f0b8a9425ff45cd281a5448e423"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/pint/zipball/93b2d0d49719bc6e444ba21cd4dbbccec935413d", "url": "https://api.github.com/repos/laravel/pint/zipball/df105cf8ce7a8f0b8a9425ff45cd281a5448e423",
"reference": "93b2d0d49719bc6e444ba21cd4dbbccec935413d", "reference": "df105cf8ce7a8f0b8a9425ff45cd281a5448e423",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -7038,12 +7038,12 @@
}, },
"require-dev": { "require-dev": {
"friendsofphp/php-cs-fixer": "^3.34.1", "friendsofphp/php-cs-fixer": "^3.34.1",
"illuminate/view": "^10.23.1", "illuminate/view": "^10.26.2",
"laravel-zero/framework": "^10.1.2", "laravel-zero/framework": "^10.1.2",
"mockery/mockery": "^1.6.6", "mockery/mockery": "^1.6.6",
"nunomaduro/larastan": "^2.6.4", "nunomaduro/larastan": "^2.6.4",
"nunomaduro/termwind": "^1.15.1", "nunomaduro/termwind": "^1.15.1",
"pestphp/pest": "^2.18.2" "pestphp/pest": "^2.20.0"
}, },
"bin": [ "bin": [
"builds/pint" "builds/pint"
@@ -7079,7 +7079,7 @@
"issues": "https://github.com/laravel/pint/issues", "issues": "https://github.com/laravel/pint/issues",
"source": "https://github.com/laravel/pint" "source": "https://github.com/laravel/pint"
}, },
"time": "2023-10-10T15:39:09+00:00" "time": "2023-10-26T09:26:10+00:00"
}, },
{ {
"name": "laravel/sail", "name": "laravel/sail",

View File

@@ -17,7 +17,6 @@ return [
* *
* Defaults to null, which uses the toString() method on your model. * Defaults to null, which uses the toString() method on your model.
*/ */
'source' => null, 'source' => null,
/** /**
@@ -25,7 +24,6 @@ return [
* no length restrictions are enforced. Set it to a positive integer if you * no length restrictions are enforced. Set it to a positive integer if you
* want to make sure your slugs aren't too long. * want to make sure your slugs aren't too long.
*/ */
'maxLength' => null, 'maxLength' => null,
/** /**
@@ -40,7 +38,6 @@ return [
* *
* "my source string" -> "my-source-st" * "my source string" -> "my-source-st"
*/ */
'maxLengthKeepWords' => true, 'maxLengthKeepWords' => true,
/** /**
@@ -58,13 +55,11 @@ return [
* *
* 'method' => array('Str','slug'), * 'method' => array('Str','slug'),
*/ */
'method' => null, 'method' => null,
/** /**
* Separator to use when generating slugs. Defaults to a hyphen. * Separator to use when generating slugs. Defaults to a hyphen.
*/ */
'separator' => '-', 'separator' => '-',
/** /**
@@ -76,7 +71,6 @@ return [
* my-slug-1 * my-slug-1
* my-slug-2 * my-slug-2
*/ */
'unique' => true, 'unique' => true,
/** /**
@@ -87,7 +81,6 @@ return [
* "similar" slugs. The closure should return the new unique * "similar" slugs. The closure should return the new unique
* suffix to append to the slug. * suffix to append to the slug.
*/ */
'uniqueSuffix' => null, 'uniqueSuffix' => null,
/** /**
@@ -107,7 +100,6 @@ return [
* If set to "false", then a new slug could duplicate one that exists on a trashed model. * If set to "false", then a new slug could duplicate one that exists on a trashed model.
* If set to "true", then uniqueness is enforced across trashed and existing models. * If set to "true", then uniqueness is enforced across trashed and existing models.
*/ */
'includeTrashed' => false, 'includeTrashed' => false,
/** /**
@@ -133,7 +125,6 @@ return [
* *
* and continue from there. * and continue from there.
*/ */
'reserved' => null, 'reserved' => null,
/** /**
@@ -146,7 +137,6 @@ return [
* is probably not a good idea from an SEO point of view. * is probably not a good idea from an SEO point of view.
* Only set this to true if you understand the possible consequences. * Only set this to true if you understand the possible consequences.
*/ */
'onUpdate' => false, 'onUpdate' => false,
/** /**

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 ChampionSeeder extends Seeder class ChampionSeeder extends Seeder

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 ChampionSkinSeeder extends Seeder class ChampionSkinSeeder extends Seeder

View File

@@ -17,6 +17,6 @@ return [
'sent' => 'We hebben je de link om je wachtwoord te resetten gemaild.', 'sent' => 'We hebben je de link om je wachtwoord te resetten gemaild.',
'throttled' => 'Wacht even voordat u het opnieuw probeert.', 'throttled' => 'Wacht even voordat u het opnieuw probeert.',
'token' => 'Wachtwoordreset token is ongeldig.', 'token' => 'Wachtwoordreset token is ongeldig.',
'user' => "We kunnen geen gebruiker met dat e-mailadres vinden.", 'user' => 'We kunnen geen gebruiker met dat e-mailadres vinden.',
]; ];

View File

@@ -6,7 +6,8 @@
"build": "vite build", "build": "vite build",
"dev-laravel": "php artisan serve", "dev-laravel": "php artisan serve",
"dev-node": "npm run dev", "dev-node": "npm run dev",
"dev-all": "npm-run-all -p dev-laravel dev-node" "dev-all": "npm-run-all -p dev-laravel dev-node",
"laravel-pint": "./vendor/bin/pint"
}, },
"devDependencies": { "devDependencies": {
"autoprefixer": "^10.4.16", "autoprefixer": "^10.4.16",

3
pint.json Normal file
View File

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