Skip to content

Commit

Permalink
[FIX] issue of case-sensitive file path in linux (unix base system)
Browse files Browse the repository at this point in the history
  • Loading branch information
moaminsharifi committed Jan 14, 2024
1 parent 0361375 commit 4139cae
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@ function getRouteName(){

if(! function_exists('getCrudConfig')) {
function getCrudConfig($name){
$namespace = "\\App\\CRUD\\{$name}Component";

if (!file_exists(app_path("/CRUD/{$name}Component.php")) or !class_exists($namespace)){
abort(403, "Class with {$namespace} namespace doesn't exist");
$className = ucwords($name);
$namespace = "\\App\\CRUD\\{$className}Component";
$appFilePath = app_path("/CRUD/{$name}Component.php");
$nsExist = class_exists($namespace);
$filePathExist = file_exists($appFilePath);

if (!$filePathExist or !$nsExist){
abort(403, "Class with {$namespace} namespace or {$appFilePath} doesn't exist, ");
}

$instance = app()->make($namespace);
Expand Down

0 comments on commit 4139cae

Please sign in to comment.