Skip to content

Commit

Permalink
Merge pull request #74 from moaminsharifi/fix/linux-file-path-case-se…
Browse files Browse the repository at this point in the history
…nsetive

[FIX] issue of case-sensitive file path in linux (unix base system)
  • Loading branch information
reziamini authored Jan 29, 2024
2 parents 0361375 + 4139cae commit 7e131c0
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

1 comment on commit 7e131c0

@yousaf-m
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on line 18
$appFilePath = app_path("/CRUD/{$name}Component.php");

in the above line "$name" should be replaced by "$className"

Please sign in to comment.