KUJUNTI.ID MINISH3LL
Path : /var/www/html/phkaynews-v2/app/Http/Livewire/Frontend/
(S)h3ll Cr3at0r :
F!le Upl0ad :

B-Con CMD Config cPanel C-Rdp D-Log Info Jump Mass Ransom Symlink vHost Zone-H

Current File : /var/www/html/phkaynews-v2/app/Http/Livewire/Frontend/HomePage.php


<?php

namespace App\Http\Livewire\Frontend;

use App\Models\Advertise;
use App\Models\Post;
use Livewire\Component;
use App\Models\Category;

class HomePage extends Component
{
    public function render()
    {
        $ids = [];
        $data['lastSlide'] = Post::publiced()->orderBy('id', 'desc')->take(6)->get();
        $slide_id = $data['lastSlide']->pluck('id')->toArray();
        $ids = array_merge($ids, $slide_id);

        $data['posts'] = Post::publiced()->where('id', '<', $ids)->descendingpost()->take(8)->get();
        // select orderby category Id = 1
        $data['categoryId1'] = Category::findOrFail(1);
        $data['sports'] = Post::publiced()->whereNotIn('id', $ids)->whereHas('post_categories', function ($query) {
            $query->where('category_id', 1);
        })->latest()->descendingpost()->take(8)->get();
        // $ids = array_merge($ids, [$data['sport1']->id]);
        $data['dara'] = Post::publiced()->whereNotIn('id', $ids)->whereHas('post_categories', function ($query) {
            $query->where('category_id', 7);
        })->latest()->descendingpost()->take(8)->get();
        //End select orderby category Id = 1
        $ids = array_merge($ids, $data['dara']->pluck("id")->toArray());

        // select orderby category Id = 2
        $data['nationalNews'] = Post::publiced()->whereNotIn('id', $ids)->whereHas('post_categories', function ($query) {
            $query->where('category_id', 2);
        })->latest()->descendingpost()->take(8)->get();
        $ids = array_merge($ids, $data['nationalNews']->pluck("id")->toArray());
        //End select orderby category Id = 2

        // select orderby category Id = 4
        $data['technologys'] = Post::publiced()->whereNotIn('id', $ids)->whereHas('post_categories', function ($query) {
            $query->where('category_id', 4);
        })->latest()->descendingpost()->take(8)->get();
        $ids = array_merge($ids, $data['technologys']->pluck("id")->toArray());
        //End select orderby category Id = 4

        $data['advertise'] = Advertise::where('type', config('ads.key.hp'))->inRandomOrder()->first();


        // select orderby view
        $data['popular_post'] = Post::publiced()->whereNotIn('id', $ids)->orderBy('view', 'DESC')->take(4)->get();

        return view('livewire.frontend.home-page', $data);
    }
}

© KUJUNTI.ID