You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

29 lines
626 B

<?php
namespace App\Http\Middleware;
use App\Entities\Projects\Project;
use Closure;
use DB;
class GlobalViewVariables
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$projectsCount = Project::select(DB::raw('status_id, count(id) as count'))
->groupBy('status_id')
->pluck('count', 'status_id')
->all();
view()->share('projectStatusStats', $projectsCount);
return $next($request);
}
}