EmployerController.php 1.03 KB
<?php

namespace App\Http\Controllers;

use App\Models\Ad_employer;
use App\Models\Category;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

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'));
        }
    }

    public function logout() {
        Auth::logout();
        return redirect()->route('index')
            ->with('success', 'Вы вышли из личного кабинета');
    }
}