Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Commit

Permalink
Update CRUDBooster.php
Browse files Browse the repository at this point in the history
Fixing get module path
  • Loading branch information
fherryfherry authored Sep 2, 2019
1 parent 047bc7a commit 7c345f1
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions src/helpers/CRUDBooster.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
class CRUDBooster
{
/**
Comma-delimited data output from the child table
* Comma-delimited data output from the child table
*/
public static function echoSelect2Mult($values, $table, $id, $name) {
$values = explode(",", $values);
Expand Down Expand Up @@ -524,13 +524,24 @@ public static function deleteConfirm($redirectTo)
function(){ location.href=\"$redirectTo\" });";
}

private static function getModulePath()
{
//use Request::path instead of default admin_path to allow flexibility for users to define their own admin_path under
// app/config/crudbooster.php
$adminPathSegments = count(explode('/', Request::path()));

return Request::segment($adminPathSegments);
public static function getModulePath()
{
// Check to position of admin_path
if(config("crudbooster.ADMIN_PATH")) {
$adminPathSegments = explode('/', Request::path());
$no = 1;
foreach($adminPathSegments as $path) {
if($path == config("crudbooster.ADMIN_PATH")) {
$segment = $no+1;
break;
}
$no++;
}
} else {
$segment = 1;
}

return Request::segment($segment);
}

public static function mainpath($path = null)
Expand Down

1 comment on commit 7c345f1

@geoffsari
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks @fherryfherry for fixing this, and appreciate merging my first ever pull request on Github. :)

Please sign in to comment.