PHP Insights added

This commit is contained in:
Anatoliy Poloz
2023-12-18 14:51:58 +03:00
parent 31128488ac
commit 1b9998cdef
71 changed files with 1655 additions and 575 deletions

View File

@@ -39,18 +39,6 @@ class Edit extends Component
$this->videoUrl = $blogPost->youtube_url;
}
protected function rules()
{
$rules = [
/* 'image' => 'required|image|max:2048', */
'state' => 'required|in:active,archived',
'description' => 'required|min:3',
'videoUrl' => 'nullable|url|max:2048',
];
return $rules;
}
public function parentComponentTagAdded(Tag $tag)
{
$tagIndex = $tag->id;
@@ -61,7 +49,7 @@ class Edit extends Component
{
$tagToDetach = Tag::where('name', $tag)->first();
$this->tags = collect($this->tags)
->filter(fn ($curTag) => $curTag['name'] != $tag)
->filter(fn ($curTag) => $curTag['name'] !== $tag)
->all();
$this->blogPost->tags()->detach($tagToDetach->id);
@@ -101,11 +89,20 @@ class Edit extends Component
$user->author_of_blog_post()->attach($post->id);
return redirect()->route('blog_post.show', $post->id);
}
public function render()
{
return view('livewire.blog-post.edit');
}
protected function rules()
{
return [
/* 'image' => 'required|image|max:2048', */
'state' => 'required|in:active,archived',
'description' => 'required|min:3',
'videoUrl' => 'nullable|url|max:2048',
];
}
}