analysators added

This commit is contained in:
Anatoliy Poloz
2023-12-18 14:36:32 +03:00
parent e9c4647f26
commit 92a54106ef
166 changed files with 32767 additions and 1222 deletions

View File

@@ -2,27 +2,30 @@
namespace App\Livewire\BlogPost;
use App\Models\BlogPost;
use App\Models\Tag;
use App\Models\User;
use Illuminate\Support\Str;
use Livewire\Component;
use Livewire\WithPagination;
use App\Models\BlogPost;
use App\Models\User;
use App\Models\Tag;
use Illuminate\Support\Str;
class ListView extends Component
{
use WithPagination;
public $search = "";
public $typeFilter = "all";
public $search = '';
public $typeFilter = 'all';
public $tag = '';
public $author;
protected $queryString = [
'search' => ['except' => ''],
'typeFilter' => ['except' => 'all'],
'tag' => ['except' => ''],
'author' => ['except' => '']
'author' => ['except' => ''],
];
public function render()
@@ -31,7 +34,7 @@ class ListView extends Component
$author = $this->author;
$user = User::find($author);
$posts = $user ? $user->author_of_blog_post()->distinct() : [];
} elseif($this->tag) {
} elseif ($this->tag) {
$tagId = Str::of($this->tag)->split('/-/')->first();
$posts = Tag::find($tagId)->blogPosts();
} elseif ($this->search && mb_strlen($this->search) > 2) {
@@ -40,7 +43,7 @@ class ListView extends Component
$posts = (new BlogPost);
}
if($this->typeFilter == 'user') {
if ($this->typeFilter == 'user') {
$posts = $posts->whereRelation('author', 'is_consultant', false);
}
if ($this->typeFilter == 'consultant') {