diff --git a/app/Livewire/Diet/LikeCount.php b/app/Livewire/Diet/LikeCount.php index 81203ea..b9f368c 100644 --- a/app/Livewire/Diet/LikeCount.php +++ b/app/Livewire/Diet/LikeCount.php @@ -3,18 +3,13 @@ namespace App\Livewire\Diet; use App\Models\Diet; -use Livewire\Component; use Illuminate\View\View; +use Livewire\Component; class LikeCount extends Component { public Diet $diet; - protected function getListeners(): array - { - return ['liked' => '$refresh']; - } - public function mount(Diet $diet): void { $this->diet = $diet; @@ -29,4 +24,9 @@ class LikeCount extends Component ] ); } + + protected function getListeners(): array + { + return ['liked' => '$refresh']; + } } diff --git a/app/Livewire/Plan/Accordion.php b/app/Livewire/Plan/Accordion.php index f51125e..7e096e8 100644 --- a/app/Livewire/Plan/Accordion.php +++ b/app/Livewire/Plan/Accordion.php @@ -3,8 +3,8 @@ namespace App\Livewire\Plan; use App\Models\Plan; -use Livewire\Component; use Illuminate\View\View; +use Livewire\Component; class Accordion extends Component { diff --git a/app/Livewire/Plan/Comment/Create.php b/app/Livewire/Plan/Comment/Create.php index 2c336fc..7bbe742 100644 --- a/app/Livewire/Plan/Comment/Create.php +++ b/app/Livewire/Plan/Comment/Create.php @@ -5,8 +5,8 @@ namespace App\Livewire\Plan\Comment; use App\Models\Plan; use App\Models\PlanComment; use App\Models\User; -use Livewire\Component; use Illuminate\View\View; +use Livewire\Component; class Create extends Component { diff --git a/app/Livewire/Plan/Comment/Show.php b/app/Livewire/Plan/Comment/Show.php index e3df6bd..17afa1b 100644 --- a/app/Livewire/Plan/Comment/Show.php +++ b/app/Livewire/Plan/Comment/Show.php @@ -3,8 +3,8 @@ namespace App\Livewire\Plan\Comment; use App\Models\Plan; -use Livewire\Component; use Illuminate\View\View; +use Livewire\Component; class Show extends Component { @@ -12,11 +12,6 @@ class Show extends Component public array $tabpanelState = ['positive' => 'positive', 'negative' => false]; - protected function getListeners(): array - { - return ['commentAdded' => '$refresh']; - } - public function render(): View { return view('livewire.plan.comment.show'); @@ -34,4 +29,9 @@ class Show extends Component } ); } + + protected function getListeners(): array + { + return ['commentAdded' => '$refresh']; + } } diff --git a/app/Livewire/Plan/Comment/Upvote.php b/app/Livewire/Plan/Comment/Upvote.php index 56fe309..7a474ce 100644 --- a/app/Livewire/Plan/Comment/Upvote.php +++ b/app/Livewire/Plan/Comment/Upvote.php @@ -3,8 +3,8 @@ namespace App\Livewire\Plan\Comment; use App\Models\PlanComment; -use Livewire\Component; use Illuminate\View\View; +use Livewire\Component; class Upvote extends Component { diff --git a/app/Livewire/Plan/Create.php b/app/Livewire/Plan/Create.php index 62ff06f..4fd3d68 100644 --- a/app/Livewire/Plan/Create.php +++ b/app/Livewire/Plan/Create.php @@ -3,13 +3,12 @@ namespace App\Livewire\Plan; use App\Models\Plan; -use Illuminate\Support\Facades\Auth; -use Livewire\Component; -/* use Tonysm\RichTextLaravel\Livewire\WithRichTexts; */ -use Livewire\WithFileUploads; -use Illuminate\View\View; -use Livewire\Features\SupportFileUploads\TemporaryUploadedFile; use Illuminate\Http\UploadedFile; +use Illuminate\Support\Facades\Auth; +/* use Tonysm\RichTextLaravel\Livewire\WithRichTexts; */ +use Illuminate\View\View; +use Livewire\Component; +use Livewire\WithFileUploads; class Create extends Component { diff --git a/app/Livewire/Plan/Edit.php b/app/Livewire/Plan/Edit.php index 9c66c14..c8920c1 100644 --- a/app/Livewire/Plan/Edit.php +++ b/app/Livewire/Plan/Edit.php @@ -3,10 +3,10 @@ namespace App\Livewire\Plan; use App\Models\Plan; +use Illuminate\Http\UploadedFile; +use Illuminate\View\View; use Livewire\Component; use Livewire\WithFileUploads; -use Illuminate\View\View; -use Illuminate\Http\UploadedFile; class Edit extends Component { diff --git a/app/Livewire/Plan/Like/AnnouncementDetails.php b/app/Livewire/Plan/Like/AnnouncementDetails.php index 2749bd5..b5eed28 100755 --- a/app/Livewire/Plan/Like/AnnouncementDetails.php +++ b/app/Livewire/Plan/Like/AnnouncementDetails.php @@ -3,9 +3,9 @@ namespace App\Livewire\Plan\Like; use App\Models\Plan; +use Illuminate\View\View; use Livewire\Attributes\On; use Livewire\Component; -use Illuminate\View\View; class AnnouncementDetails extends Component { diff --git a/app/Livewire/Plan/Like/AnnouncementFooter.php b/app/Livewire/Plan/Like/AnnouncementFooter.php index 6e8491f..0cb3efb 100755 --- a/app/Livewire/Plan/Like/AnnouncementFooter.php +++ b/app/Livewire/Plan/Like/AnnouncementFooter.php @@ -3,9 +3,9 @@ namespace App\Livewire\Plan\Like; use App\Models\Plan; +use Illuminate\View\View; use Livewire\Attributes\On; use Livewire\Component; -use Illuminate\View\View; class AnnouncementFooter extends Component { diff --git a/app/Livewire/Plan/LikeCount.php b/app/Livewire/Plan/LikeCount.php index 5679337..d63e4e1 100755 --- a/app/Livewire/Plan/LikeCount.php +++ b/app/Livewire/Plan/LikeCount.php @@ -3,18 +3,13 @@ namespace App\Livewire\Plan; use App\Models\Plan; -use Livewire\Component; use Illuminate\View\View; +use Livewire\Component; class LikeCount extends Component { public Plan $plan; - protected function getListeners(): array - { - return ['liked-details' => '$refresh', 'liked-footer' => '$refresh']; - } - public function mount(Plan $plan): void { $this->plan = $plan; @@ -32,4 +27,9 @@ class LikeCount extends Component ] ); } + + protected function getListeners(): array + { + return ['liked-details' => '$refresh', 'liked-footer' => '$refresh']; + } } diff --git a/app/Livewire/Recipe/Comment/Create.php b/app/Livewire/Recipe/Comment/Create.php index 9b65b34..40bc80f 100644 --- a/app/Livewire/Recipe/Comment/Create.php +++ b/app/Livewire/Recipe/Comment/Create.php @@ -5,8 +5,8 @@ namespace App\Livewire\Recipe\Comment; use App\Models\Recipe; use App\Models\RecipeComment; use App\Models\User; -use Livewire\Component; use Illuminate\View\View; +use Livewire\Component; class Create extends Component { diff --git a/app/Livewire/Recipe/Comment/Show.php b/app/Livewire/Recipe/Comment/Show.php index ebf5353..f731ccb 100644 --- a/app/Livewire/Recipe/Comment/Show.php +++ b/app/Livewire/Recipe/Comment/Show.php @@ -3,8 +3,8 @@ namespace App\Livewire\Recipe\Comment; use App\Models\Recipe; -use Livewire\Component; use Illuminate\View\View; +use Livewire\Component; class Show extends Component { @@ -19,11 +19,6 @@ class Show extends Component return view('livewire.recipe.comment.show'); } - protected function getListeners(): array - { - return ['commentAdded' => '$refresh']; - } - public function toggleTabpanelState(string $tabpanelName): void { collect($this->tabpanelState)->keys()->each( @@ -36,4 +31,9 @@ class Show extends Component } ); } + + protected function getListeners(): array + { + return ['commentAdded' => '$refresh']; + } } diff --git a/app/Livewire/Recipe/Comment/Upvote.php b/app/Livewire/Recipe/Comment/Upvote.php index 9cae4d2..b889295 100644 --- a/app/Livewire/Recipe/Comment/Upvote.php +++ b/app/Livewire/Recipe/Comment/Upvote.php @@ -3,8 +3,8 @@ namespace App\Livewire\Recipe\Comment; use App\Models\RecipeComment; -use Livewire\Component; use Illuminate\View\View; +use Livewire\Component; class Upvote extends Component { diff --git a/app/Livewire/Recipe/Create.php b/app/Livewire/Recipe/Create.php index e315f21..447551e 100644 --- a/app/Livewire/Recipe/Create.php +++ b/app/Livewire/Recipe/Create.php @@ -4,16 +4,13 @@ namespace App\Livewire\Recipe; use App\Models\Recipe; use App\Models\Tag; +use Illuminate\Http\UploadedFile; +use Illuminate\Support\Collection; use Illuminate\Support\Facades\Auth; +use Illuminate\View\View; use Livewire\Attributes\On; use Livewire\Component; use Livewire\WithFileUploads; -use Illuminate\View\View; -use Illuminate\Support\Collection; -use Illuminate\Support\Facades\Storage; -use Illuminate\Filesystem\FilesystemAdapter; -use Livewire\Features\SupportFileUploads\TemporaryUploadedFile; -use Illuminate\Http\UploadedFile; class Create extends Component { @@ -52,11 +49,6 @@ class Create extends Component public array $state_row = ['ingredient' => 'true', 'article' => 'false']; - protected function getListeners(): array - { - return ['stepRemoved' => '$refresh']; - } - public function toggleStateRow(string $currentRow): void { collect($this->state_row)->keys()->map( @@ -163,6 +155,11 @@ class Create extends Component return view('livewire.recipe.create'); } + protected function getListeners(): array + { + return ['stepRemoved' => '$refresh']; + } + protected function rules(): array { return [ diff --git a/app/Livewire/Recipe/Edit.php b/app/Livewire/Recipe/Edit.php index 400da3b..fd7545d 100644 --- a/app/Livewire/Recipe/Edit.php +++ b/app/Livewire/Recipe/Edit.php @@ -4,11 +4,11 @@ namespace App\Livewire\Recipe; use App\Models\Recipe; use App\Models\Tag; -use Livewire\Component; -use Livewire\WithFileUploads; -use Illuminate\View\View; use Illuminate\Database\Eloquent\Casts\AsCollection; use Illuminate\Support\Collection; +use Illuminate\View\View; +use Livewire\Component; +use Livewire\WithFileUploads; class Edit extends Component { @@ -48,13 +48,6 @@ class Edit extends Component public array $state_row = ['ingredient' => 'true', 'article' => 'false']; - // protected $listeners = ['stepRemoved' => '$refresh', 'parentComponentTagAdded', 'parentComponentTagRemoved']; - - protected function getListeners(): array - { - return ['stepRemoved' => '$refresh', 'parentComponentTagAdded', 'parentComponentTagRemoved']; - } - public function mount(Recipe $recipe): void { $this->image = $recipe->image; @@ -170,6 +163,13 @@ class Edit extends Component return view('livewire.recipe.edit'); } + // protected $listeners = ['stepRemoved' => '$refresh', 'parentComponentTagAdded', 'parentComponentTagRemoved']; + + protected function getListeners(): array + { + return ['stepRemoved' => '$refresh', 'parentComponentTagAdded', 'parentComponentTagRemoved']; + } + protected function rules(): array { return [ diff --git a/app/Livewire/Recipe/Like.php b/app/Livewire/Recipe/Like.php index a9b3d13..b8c2362 100644 --- a/app/Livewire/Recipe/Like.php +++ b/app/Livewire/Recipe/Like.php @@ -3,8 +3,8 @@ namespace App\Livewire\Recipe; use App\Models\Recipe; -use Livewire\Component; use Illuminate\View\View; +use Livewire\Component; class Like extends Component { diff --git a/app/Livewire/Recipe/LikeCount.php b/app/Livewire/Recipe/LikeCount.php index 536a3e9..e24df23 100644 --- a/app/Livewire/Recipe/LikeCount.php +++ b/app/Livewire/Recipe/LikeCount.php @@ -3,18 +3,13 @@ namespace App\Livewire\Recipe; use App\Models\Recipe; -use Livewire\Component; use Illuminate\View\View; +use Livewire\Component; class LikeCount extends Component { public Recipe $recipe; - protected function getListeners(): array - { - return ['liked' => '$refresh']; - } - public function mount(Recipe $recipe): void { $this->recipe = $recipe; @@ -27,4 +22,9 @@ class LikeCount extends Component ['count' => $this->recipe->likes_count] ); } + + protected function getListeners(): array + { + return ['liked' => '$refresh']; + } } diff --git a/app/Livewire/Recipe/ListView.php b/app/Livewire/Recipe/ListView.php index a298310..3790be5 100644 --- a/app/Livewire/Recipe/ListView.php +++ b/app/Livewire/Recipe/ListView.php @@ -6,9 +6,9 @@ use App\Models\Recipe; use App\Models\Tag; use App\Models\User; use Illuminate\Support\Str; +use Illuminate\View\View; use Livewire\Component; use Livewire\WithPagination; -use Illuminate\View\View; class ListView extends Component { diff --git a/app/Models/CommentUpvote.php b/app/Models/CommentUpvote.php index 8ed59af..befe36d 100644 --- a/app/Models/CommentUpvote.php +++ b/app/Models/CommentUpvote.php @@ -2,10 +2,10 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; -use Illuminate\Database\Eloquent\Builder; /** * App\Models\CommentUpvote diff --git a/app/Models/Plan.php b/app/Models/Plan.php index 71c06e9..dfeed41 100644 --- a/app/Models/Plan.php +++ b/app/Models/Plan.php @@ -9,11 +9,11 @@ use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\HasMany; use Laracasts\Presenter\PresentableTrait; use Spatie\Sluggable\HasSlug; use Spatie\Sluggable\SlugOptions; -use Illuminate\Database\Eloquent\Relations\BelongsToMany; /** * App\Models\Plan @@ -178,7 +178,7 @@ class Plan extends Model implements Viewable public function scopeNegativeComments(Builder $query): HasMany { - return static::comments()->where('grade', '<=', '3'); + return static::comments()->where('grade', '<=', '3'); } public function scopePositiveComments(Builder $query): HasMany diff --git a/app/Models/PlanComment.php b/app/Models/PlanComment.php index fe708cc..6e0f678 100644 --- a/app/Models/PlanComment.php +++ b/app/Models/PlanComment.php @@ -4,9 +4,8 @@ namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; -use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\BelongsTo; -use App\Models\User; +use Illuminate\Database\Eloquent\Relations\HasMany; /** * App\Models\PlanComment @@ -44,7 +43,7 @@ class PlanComment extends Model public function author(): BelongsTo { - return $this->belongsTo(User::class, 'user_id'); + return $this->belongsTo(User::class, 'user_id'); } public function plan(): BelongsTo diff --git a/app/Models/PlanLike.php b/app/Models/PlanLike.php index ad0eee4..a55b4d4 100644 --- a/app/Models/PlanLike.php +++ b/app/Models/PlanLike.php @@ -2,9 +2,9 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; -use Illuminate\Database\Eloquent\Builder; /** * App\Models\PlanLike diff --git a/app/Models/Recipe.php b/app/Models/Recipe.php index 3a6bb09..9e090b2 100755 --- a/app/Models/Recipe.php +++ b/app/Models/Recipe.php @@ -10,10 +10,10 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasOneThrough; -use Spatie\Sluggable\HasSlug; -use Spatie\Sluggable\SlugOptions; use Illuminate\Database\Eloquent\Relations\MorphToMany; use Illuminate\Support\Str; +use Spatie\Sluggable\HasSlug; +use Spatie\Sluggable\SlugOptions; /** * App\Models\Recipe diff --git a/app/Models/RecipeComment.php b/app/Models/RecipeComment.php index c425bd2..e34bcea 100644 --- a/app/Models/RecipeComment.php +++ b/app/Models/RecipeComment.php @@ -4,8 +4,8 @@ namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; -use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\HasMany; /** * App\Models\RecipeComment diff --git a/app/Models/RecipeCommentUpvote.php b/app/Models/RecipeCommentUpvote.php index 81ea0c0..54ce6ec 100644 --- a/app/Models/RecipeCommentUpvote.php +++ b/app/Models/RecipeCommentUpvote.php @@ -2,10 +2,10 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; -use Illuminate\Database\Eloquent\Builder; /** * App\Models\RecipeCommentUpvote diff --git a/app/Models/RecipeLike.php b/app/Models/RecipeLike.php index cfad708..93a51e2 100644 --- a/app/Models/RecipeLike.php +++ b/app/Models/RecipeLike.php @@ -2,9 +2,9 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; -use Illuminate\Database\Eloquent\Builder; /** * App\Models\RecipeLike diff --git a/app/Models/Tag.php b/app/Models/Tag.php index 00603c2..752fd58 100644 --- a/app/Models/Tag.php +++ b/app/Models/Tag.php @@ -5,8 +5,8 @@ namespace App\Models; use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; -use Illuminate\Support\Str; use Illuminate\Database\Eloquent\Relations\MorphToMany; +use Illuminate\Support\Str; /** * App\Models\Tag @@ -43,7 +43,7 @@ class Tag extends Model return $this->morphedByMany(BlogPost::class, 'taggable', 'taggables'); } - public function recipes():MorphToMany + public function recipes(): MorphToMany { return $this->morphedByMany(Recipe::class, 'taggable', 'taggables'); } diff --git a/app/Presenters/PlanPresenter.php b/app/Presenters/PlanPresenter.php index ec17777..b414553 100644 --- a/app/Presenters/PlanPresenter.php +++ b/app/Presenters/PlanPresenter.php @@ -2,9 +2,9 @@ namespace App\Presenters; +use App\Models\User; use Illuminate\Support\Facades\Storage; use Laracasts\Presenter\Presenter; -use App\Models\User; /** * @property User $author @@ -20,6 +20,6 @@ class PlanPresenter extends Presenter public function getAuthor(): User { - return $this->author->first(); + return $this->author->first(); } }