EmployerController.php 829 Bytes
<?php

namespace App\Http\Controllers;

use App\Models\Ad_employer;
use App\Models\Category;
use Illuminate\Http\Request;

class EmployerController extends Controller
{
    public function vacancie($vacancy, Request $request) {
        $title = 'Заголовок вакансии';

        $Query = Ad_employer::with('jobs')->
                              with('cat')->
                              with('employer')->
                              with('jobs_code')->
                              select('ad_employers.*')->
                              where('id', '=', $vacancy)->get();

        $title = $Query[0]->name;
        if ($request->ajax()) {
            return view('ajax.vacance-item', compact('Query'));
        } else {
            return view('vacance-item', compact('title', 'Query'));
        }
    }
}