<?php

use App\Models\tbl_permission;
use App\Models\User;

function permission($user_id, $feature_id,$actionColumn) {
  
   
    $featureTable = tbl_permission::where('user_id', $user_id)->where('feature_id', $feature_id)->first();

   if ($user_id== '1') {
        return true; 
    } else {
        if (isset($featureTable->$actionColumn)) {
           
            if ($featureTable->$actionColumn == '1') {
                return true; 
            } else {
                return false; 
            }
        } else {
          
            return false; 
        }
    }
    
}