%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/digiprint/app/Http/Controllers/
Upload File :
Create Path :
Current File : /var/www/html/digiprint/app/Http/Controllers/FrontEndController.php

<?php

namespace Digiprint\Http\Controllers;

use Illuminate\Http\Request;
use Digiprint\Models\Media;
use Digiprint\Models\Technology;
use Digiprint\Models\Category;
use Digiprint\Providers\MorphableName;

class FrontEndController extends Controller
{
    public function HomePage()
    {
        return view('welcome');
    }

    public function ShowAllTechnologies()
    {
        $technologies = Technology::query()
                                  ->orderBy('order')
                                  ->get();
        return view('technology')->with([
            'technologies' => $technologies,
        ]);
    }

    public function GetCategories($slug)
    {
        $mainCategory = Category::query()
                                ->where('slug', $slug)
                                ->take(1)
                                ->get();
        if (count($mainCategory) != 0) {
            $mainCategory = $mainCategory[0];
            $rootCategories = Category::query()
                                      ->whereNull('parent_id')
                                      ->orderBy('order')
                                      ->get();
            return view('category')->with([
                'mainCategory'   => $mainCategory,
                'rootCategories' => $rootCategories,
            ]);
        }
        return view("errors.404");
    }

    public function GetCategoryDetails($parentSlug, $slug)
    {
        $category = Category::query()
                            ->where('slug', $slug)
                            ->whereNotNull('parent_id')
                            ->take(1)
                            ->get();
        if (count($category) != 0) {
            $category = $category[0];
            $relatedCategory = Category::query()
                                       ->whereNotNull('parent_id')
                                       ->inRandomOrder()
                                       ->take(9)
                                       ->get();
            return view('categoryDetails')->with([
                'category'          => $category,
                'relatedCategories' => $relatedCategory,
            ]);
        }

        return view("errors.404");
    }
}

Zerion Mini Shell 1.0