??????????????
<?php

namespace App\Providers\ViewComposers;

use Illuminate\Contracts\View\View;
use App\Catalogs;
use App\Saloon;
use App\Artist;
use Auth;

class ManagerComposer
{

    public function compose(View $view)
    {
        $ur = url()->full();
        $arr = explode('/', $ur);
        $end = end($arr);
        if(isset($arr[4])){
            $link = $arr[4];
        }else{
            $link = 'artist';
        }
        $catalogs = Catalogs::all();
        $saloons = Saloon::all();
        $saloon = Saloon::where('manager_id', Auth::user()->id)->first();
        if(isset($saloon->id)){
            $artists = Artist::where('saloon_id', $saloon->id)->whereNotNull('categories')->where('showhide','show')->get();
        }else{
            $saloon = Saloon::query()->first();
            $artists = Artist::whereNotNull('categories')->where('showhide','show')->get();
        }

        $view->with('end', $end)->with('catalogs', $catalogs)->with('saloons', $saloons)->with('saloon', $saloon)->with('link', $link)->with('artists', $artis