<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Validation\Rule;

class AjaxController extends Controller
{

    public function checkPermissions(Request $request)
    {
        $permissions = $request->get('permissions', []);

        $results = [];
        foreach ($permissions as $permission) {
            $results[$permission] = auth()->user()->can($permission);
        }

        return response()->json($results);
    }
}
