<?php

namespace App\Http\Middleware;

use Closure;

class Organisation
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    // public function handle($request, Closure $next)
    // {
    //     return $next($request);
    // }
    public function handle($request, Closure $next)
    {
        // $merchant = session('merchant');
        if(!$request->session()->has('current_org_user')){
            return redirect(url('/organisation/login'))->withErrors("You need to be logged in");
        }
        return $next($request);
    }
}
