Skip to content

Commit

Permalink
Merge pull request #104 from RonasIT/86c0x8ucu-laravel-pint
Browse files Browse the repository at this point in the history
Install laravel-pint
  • Loading branch information
DenTray authored Nov 18, 2024
2 parents 541830a + d376f0c commit abb3b76
Show file tree
Hide file tree
Showing 37 changed files with 432 additions and 1,432 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests-with-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
redis:
image: redis:7.2
env:
ALLOW_EMPTY_PASSWORD: yes
ALLOW_EMPTY_PASSWORD: "yes"
ports:
- 6379:6379
options: >-
Expand Down
23 changes: 0 additions & 23 deletions .php-cs-fixer.dist.php

This file was deleted.

6 changes: 3 additions & 3 deletions app/Console/Commands/Init.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ protected function fillReadme(): void
$type = $this->choice(
question: 'What type of application will your API serve?',
choices: ['Mobile', 'Web', 'Multiplatform'],
default: 'Multiplatform'
default: 'Multiplatform',
);

$this->setReadmeValue($file, 'type', $type);
Expand All @@ -162,12 +162,12 @@ protected function fillResources(): void
foreach (self::RESOURCES_ITEMS as $key => $title) {
$defaultAnswer = (in_array($key, self::DEFAULT_URLS)) ? $this->appUrl . "/{$key}" : 'later';
$text = "Are you going to use {$title}? "
. "Please enter a link or select `later` to do it later, otherwise select `no`.";
. 'Please enter a link or select `later` to do it later, otherwise select `no`.';

$link = $this->anticipate(
$text,
['later', 'no'],
$defaultAnswer
$defaultAnswer,
);

if ($link === 'later') {
Expand Down
6 changes: 3 additions & 3 deletions app/Http/Controllers/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
use App\Http\Requests\Auth\RefreshTokenRequest;
use App\Http\Requests\Auth\RegisterUserRequest;
use App\Http\Requests\Auth\RestorePasswordRequest;
use App\Http\Resources\Auth\SuccessLoginResource;
use App\Http\Resources\Auth\RefreshTokenResource;
use Illuminate\Http\Response;
use App\Http\Resources\Auth\SuccessLoginResource;
use App\Services\UserService;
use App\Traits\TokenTrait;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Password;
use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;
use PHPOpenSourceSaver\JWTAuth\Exceptions\JWTException;
use PHPOpenSourceSaver\JWTAuth\JWTAuth;
use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;
use Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException;

class AuthController extends Controller
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/SettingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
use App\Http\Requests\Setting\GetSettingRequest;
use App\Http\Requests\Setting\SearchSettingRequest;
use App\Http\Requests\Setting\UpdateSettingRequest;
use App\Http\Resources\Setting\SettingsCollectionResource;
use App\Http\Resources\Setting\SettingResource;
use App\Http\Resources\Setting\SettingsCollectionResource;
use App\Services\SettingService;
use Illuminate\Http\Response;

Expand All @@ -23,7 +23,7 @@ public function update(UpdateSettingRequest $request, SettingService $service, s
{
$service->update(
['name' => $key],
['value' => $request->all()]
['value' => $request->all()],
);

return response('', Response::HTTP_NO_CONTENT);
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

class Role extends Model
{
use ModelTrait;
use HasFactory;
use ModelTrait;

public const ADMIN = 1;
public const USER = 2;
Expand Down
12 changes: 6 additions & 6 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

use App\Enums\VersionEnum;
use Illuminate\Routing\Route;
use Illuminate\Routing\RouteRegistrar;
use Illuminate\Support\Facades\Route as RouteFacade;
use Illuminate\Support\ServiceProvider;
use Illuminate\Routing\RouteRegistrar;

class AppServiceProvider extends ServiceProvider
{
Expand All @@ -15,13 +15,13 @@ public function boot(): void
/**
* Specify that the route version must be in the range of given values inclusive.
*
* @param VersionEnum|null $start
* @param VersionEnum|null $end
* @param string|null $param (default is 'version')
* @param Route|null $instance
* @param VersionEnum|null $start
* @param VersionEnum|null $end
* @param string|null $param (default is 'version')
* @param Route|null $instance
* @return Route|RouteRegistrar
*/
$versionRange = function (?VersionEnum $start, ?VersionEnum $end, ?string $param, Route $instance = null) {
$versionRange = function (?VersionEnum $start, ?VersionEnum $end, ?string $param, ?Route $instance = null) {
if (!$param) {
$param = 'version';
}
Expand Down
4 changes: 2 additions & 2 deletions app/Repositories/RoleRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
use RonasIT\Support\Repositories\BaseRepository;

/**
* @property Role $model
*/
* @property Role $model
*/
class RoleRepository extends BaseRepository
{
public function __construct()
Expand Down
4 changes: 2 additions & 2 deletions app/Repositories/SettingRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
use RonasIT\Support\Repositories\BaseRepository;

/**
* @property Setting $model
*/
* @property Setting $model
*/
class SettingRepository extends BaseRepository
{
public function __construct()
Expand Down
5 changes: 2 additions & 3 deletions app/Repositories/UserRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
namespace App\Repositories;

use App\Models\User;
use Carbon\Carbon;
use RonasIT\Support\Repositories\BaseRepository;

/**
* @property User $model
*/
* @property User $model
*/
class UserRepository extends BaseRepository
{
public function __construct()
Expand Down
1 change: 1 addition & 0 deletions app/Services/RoleService.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

/**
* @property RoleRepository $repository
*
* @mixin RoleRepository
*/
class RoleService extends EntityService
Expand Down
1 change: 1 addition & 0 deletions app/Services/SettingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

/**
* @property SettingRepository $repository
*
* @mixin SettingRepository
*/
class SettingService extends EntityService
Expand Down
15 changes: 7 additions & 8 deletions app/Services/UserService.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

/**
* @property UserRepository $repository
*
* @mixin UserRepository
*/
class UserService extends EntityService
Expand Down Expand Up @@ -54,21 +55,19 @@ public function forgotPassword(string $email): string
{
return Password::sendResetLink(
credentials: ['email' => $email],
callback: fn ($user, $token) =>
Mail::to($user->email)->send(new ForgotPasswordMail(['hash' => $token]))
callback: fn ($user, $token) => Mail::to($user->email)->send(new ForgotPasswordMail(['hash' => $token])),
);
}

public function restorePassword(array $credentials): string
{
return Password::reset(
credentials: $credentials,
callback: fn (User $user, string $password) =>
$this->repository
->force()
->update($user->id, [
'password' => Hash::make($password),
])
callback: fn (User $user, string $password) => $this->repository
->force()
->update($user->id, [
'password' => Hash::make($password),
]),
);
}
}
4 changes: 2 additions & 2 deletions bootstrap/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
use Illuminate\Session\TokenMismatchException;
use Illuminate\Validation\ValidationException;
use Illuminate\View\Middleware\ShareErrorsFromSession;
use PHPUnit\Framework\ExpectationFailedException;
use RonasIT\AutoDoc\Http\Middleware\AutoDocMiddleware;
use Symfony\Component\HttpKernel\Exception\HttpException;
use PHPUnit\Framework\ExpectationFailedException;

return Application::configure(basePath: dirname(__DIR__))
->withRouting(
Expand All @@ -37,7 +37,7 @@
commands: __DIR__ . '/../routes/console.php',
channels: __DIR__ . '/../routes/channels.php',
health: '/status',
apiPrefix: ''
apiPrefix: '',
)
->withMiddleware(function (Middleware $middleware) {
$middleware->use([
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,13 @@
"require-dev": {
"ext-json": "*",
"barryvdh/laravel-ide-helper": "^3.1",
"codedefective/cg-hooks": "^3.1",
"brainmaestro/composer-git-hooks": "^3.0",
"fakerphp/faker": "^1.23",
"friendsofphp/php-cs-fixer": "^3.8",
"laravel/pint": "^1.18",
"mockery/mockery": "^1.6",
"php-coveralls/php-coveralls": "^2.7",
"phpunit/phpunit": "^10.5",
"ronasit/laravel-entity-generator": "^3.1",
"tightenco/tlint": "^9.3"
"ronasit/laravel-entity-generator": "^3.1"
},
"autoload": {
"classmap": [
Expand All @@ -56,6 +55,7 @@
},
"scripts": {
"post-install-cmd": [
"git config --global --add safe.directory /app",
"php artisan clear-compiled",
"[ $COMPOSER_DEV_MODE -eq 0 ] || php artisan ide-helper:generate",
"[ $COMPOSER_DEV_MODE -eq 0 ] || php artisan ide-helper:meta",
Expand Down Expand Up @@ -88,7 +88,7 @@
"stop-on-failure": ["pre-commit"]
},
"pre-commit": [
"docker compose up -d php && docker compose exec -T php vendor/bin/php-cs-fixer fix && docker compose exec -T php vendor/bin/tlint"
"docker compose -f docker-compose.analyse.yaml up -d && docker compose -f docker-compose.analyse.yaml exec -T nginx vendor/bin/pint"
]
}
},
Expand Down
Loading

0 comments on commit abb3b76

Please sign in to comment.