rector code refactoring

This commit is contained in:
Anatoliy Poloz
2023-12-28 16:30:19 +03:00
parent 01376c9536
commit 0efb8536dd
22 changed files with 41 additions and 39 deletions

View File

@@ -53,7 +53,7 @@ class Kernel extends HttpKernel
*
* @var array<string, class-string|string>
*/
protected $routeMiddleware = [
protected $middlewareAliases = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,

View File

@@ -14,15 +14,6 @@ class ProcessDietSelectedNotification implements ShouldQueue
public $afterCommit = true;
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
{
}
/**
* Handle the event.
*

View File

@@ -12,7 +12,7 @@ class Create extends Component
{
use WithFileUploads;
public $image = null;
public $image;
public $state = 'archived';

View File

@@ -14,7 +14,7 @@ class Edit extends Component
public BlogPost $blogPost;
public $image = null;
public $image;
public $state = 'archived';

View File

@@ -13,7 +13,7 @@ class Create extends Component
public $name = '';
public $image = null;
public $image;
public $duration = '7';
@@ -25,9 +25,9 @@ class Create extends Component
public $days = [];
public $copyedDay = null;
public $copyedDay;
public $copyedDayData = null;
public $copyedDayData;
protected $listeners = ['dayUpdated', 'makeCopy', 'makePaste'];

View File

@@ -11,7 +11,7 @@ class Edit extends Component
public $name = '';
public $image = null;
public $image;
public $duration = '7';
@@ -23,9 +23,9 @@ class Edit extends Component
public $days = [];
public $copyedDay = null;
public $copyedDay;
public $copyedDayData = null;
public $copyedDayData;
protected $listeners = ['dayUpdated', 'makeCopy', 'makePaste'];

View File

@@ -14,7 +14,7 @@ class Create extends Component
public $name = '';
public $image = null;
public $image;
public $duration = '7';

View File

@@ -14,7 +14,7 @@ class Edit extends Component
public $name = '';
public $image = null;
public $image;
public $duration = '7';

View File

@@ -83,7 +83,7 @@ class Create extends Component
foreach ($productKeys as [$key100, $keyPortion]) {
if ($this->{$keyPortion}) {
$newVal = (float) ($k * (float) $this->{$keyPortion});
$newVal = $k * (float) $this->{$keyPortion};
$this->fill([$key100 => $newVal]);
}
}
@@ -101,7 +101,7 @@ class Create extends Component
$k = $mass / 100;
foreach ($productKeys as [$key100, $keyPortion]) {
if ($this->{$key100}) {
$newVal = (float) ($k * (float) $this->{$key100});
$newVal = $k * (float) $this->{$key100};
$this->fill([$keyPortion => $newVal]);
}
}

View File

@@ -104,7 +104,7 @@ class Edit extends Component
foreach ($productKeys as [$key100, $keyPortion]) {
if ($this->{$keyPortion}) {
$newVal = (float) ($k * (float) $this->{$keyPortion});
$newVal = $k * (float) $this->{$keyPortion};
$this->fill([$key100 => $newVal]);
}
}
@@ -122,7 +122,7 @@ class Edit extends Component
$k = $mass / 100;
foreach ($productKeys as [$key100, $keyPortion]) {
if ($this->{$key100}) {
$newVal = (float) ($k * (float) $this->{$key100});
$newVal = $k * (float) $this->{$key100};
$this->fill([$keyPortion => $newVal]);
}
}

View File

@@ -108,6 +108,12 @@ class Step1 extends Component
public function skipStep()
{
$validatedData = $this->getValidateData($this->step);
$registrationdata = session()->get('registrationdata', []);
$mergetdRegistrationData = array_merge($validatedData, $registrationdata);
session()->put('registrationdata', $mergetdRegistrationData);
return redirect()
->route(
'register.step1',
@@ -240,9 +246,4 @@ class Step1 extends Component
{
return 'step'.(int) Str::replaceFirst('step', '', $this->step) + 1;
}
private function getValidateMessages()
{
return ['required' => 'The :attribute field is required'];
}
}

View File

@@ -11,7 +11,7 @@ class TagsComponent extends Component
{
public $tags;
public $parentComponent = null;
public $parentComponent;
// protected $listeners = ['tagAdded', 'tagRemoved'];

View File

@@ -8,6 +8,7 @@ use Illuminate\Database\Eloquent\Casts\AsCollection;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasOneThrough;
use Illuminate\Contracts\Database\Eloquent\Builder;
use Spatie\Sluggable\HasSlug;
use Spatie\Sluggable\SlugOptions;
@@ -59,7 +60,7 @@ class Recipe extends Model implements Viewable
/* return $this->belongsToMany(User::class, 'recipe_author', 'recipe_id', 'user_id'); */
/* } */
public function author()
public function author(): HasOneThrough
{
return $this
->hasOneThrough(User::class, RecipeAuthor::class, 'recipe_id', 'id', 'id', 'user_id')

View File

@@ -12,7 +12,6 @@ class FeedService
{
public static function showActualFeed()
{
$days = 5;
$dateMax = Recipe::max('created_at');
$dateMin = Carbon::parse($dateMax)->subDays(10);

View File

@@ -15,6 +15,7 @@ return [
't10m' => '10 минут',
't20m' => '20 минут',
't30m' => '30 минут',
't45m' => '45 минут',
't60m' => '1 час',
't120m' => '2 час',
't14400m' => '10 дней',

View File

@@ -13709,7 +13709,10 @@ video {
color: #fff;
}.active-icon-heart{
color: #2f80ed;
}/* Recipe-show like */.text-blue-400 { color: #2f80ed; }.text-blue-500 { color: #2f80ed;}.text-gray-400 { color: #cbd5e0; }.text-gray-500 { color: #a0aec0; }@media (prefers-color-scheme: dark) {.dark\:prose-invert {
}/* Recipe-show like */.text-blue-400 { color: #2f80ed; }.text-blue-500 { color: #2f80ed;}.text-gray-400 { color: #cbd5e0; }.text-gray-500 { color: #a0aec0; }.review__info {
min-width: 120px;
width: 120px;
}@media (prefers-color-scheme: dark) {.dark\:prose-invert {
--tw-prose-body: var(--tw-prose-invert-body);
--tw-prose-headings: var(--tw-prose-invert-headings);
--tw-prose-lead: var(--tw-prose-invert-lead);

View File

@@ -25,8 +25,7 @@
Изображение
</div>
<label class="file">
<input wire:model="image" type="file" name="file" class="file__input hidden"
hidden="">
<input wire:model="image" type="file" name="file" class="file__input hidden" hidden="">
@error('image')
<span class="error">{{ $message }}</span>
@enderror

View File

@@ -23,8 +23,8 @@
'tabpanel',
'tabpanel--hidden' => $tabpanelState['negative']
]) role="tabpanel" id="tabpanel-1" tabindex="0" aria-labelledby="tab-1">
@foreach ($positivComments->get() as $comment)
<div class="reviews__items">
@foreach ($positivComments->get() as $comment)
<div class="review">
<div class="review__thumb">
<img src="{{ $comment->author->profile_photo_url }}" class="cover-image" alt="user">
@@ -44,8 +44,8 @@
<livewire:recipe.comment.upvote :wire:key="$comment->id" :comment="$comment"></liviwire:recipe.comment.upvote>
</div>
</div>
</div>
@endforeach
</div>
</div>

View File

@@ -1,6 +1,9 @@
@extends('layouts/eatvio')
@section('page_title', 'Create Recipe')
@php
$isRecipeNavigationUrlActive = true;
@endphp
@section('main_section')
@isset($recipe)
@livewire('recipe.edit', ['recipe' => $recipe]);

View File

@@ -29,6 +29,10 @@
</svg>
<span class="d-none d-md-inline">{{ __('profile.settings') }}</span>
</a>
<form action="/logout" method="post">
@csrf
<button class="l-btn l-btn-primary l-btn-sm ml-6" type="submit">Logout</button>
</form>
@endif
</div>

View File

@@ -23,7 +23,7 @@ class DeleteAccountTest extends TestCase
$this->actingAs($user = User::factory()->create());
$component = Livewire::test(DeleteUserForm::class)
Livewire::test(DeleteUserForm::class)
->set('password', 'password')
->call('deleteUser');

View File

@@ -38,7 +38,7 @@ class PasswordResetTest extends TestCase
$user = User::factory()->create();
$response = $this->post('/forgot-password', [
$this->post('/forgot-password', [
'email' => $user->email,
]);