Add all files
This commit is contained in:
21
app/Livewire/Home.php
Normal file
21
app/Livewire/Home.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use App\Models\Category;
|
||||
|
||||
class Home extends Component
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
return view('home', [
|
||||
// Categories which have NO parent and at least one child
|
||||
'categories' => Category::whereNull('parent_id')->where(function ($query) {
|
||||
$query->whereHas('children')->orWhereHas('products', function ($query) {
|
||||
$query->where('hidden', false);
|
||||
});
|
||||
})->orderBy('sort')->get(),
|
||||
'title' => 'Home',
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user