Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmoud Ibrahim authored and Mahmoud Ibrahim committed Mar 22, 2022
1 parent 701b01c commit 8e43961
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -38,7 +38,7 @@

`Package Name: IT`

`Version: 1.6.38`
`Version: 1.6.39`

`Offline Docs: 1.1` - [Online Docs](https://it.phpanonymous.com/docs)

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Expand Up @@ -22,7 +22,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "1.6.38.x-dev"
"dev-master": "1.6.39.x-dev"
},
"laravel": {
"providers": [
Expand All @@ -33,7 +33,7 @@
}
}
},
"version":"1.6.38",
"version":"1.6.39",
"minimum-stability": "dev",
"prefer-stable": true
}
2 changes: 1 addition & 1 deletion it/helper/it.php
Expand Up @@ -72,7 +72,7 @@ function it_version_message() {

if (!function_exists('it_version')) {
function it_version() {
$version = '1.6.38';
$version = '1.6.39';
app()->singleton('it_version', function () use ($version) {
return $version;
});
Expand Down
32 changes: 20 additions & 12 deletions it/views/baboon/Initialize.blade.php
Expand Up @@ -21,25 +21,32 @@
<label for="model_namespace" class="col-md-12">{{it_trans('it.model_namespace')}}</label>
<select name="model_namespace" size="5" class="form-control model_namespace">
<option value="App" selected>App</option>
@foreach(array_filter(glob(app_path().'/*'), 'is_dir') as $namespaces)
<?php
<?php
$main_model_path = array_filter(glob(app_path().'/*'), 'is_dir');
$sub_model_path = array_filter(glob(app_path().'/Models/*'), 'is_dir');
$main_path = array_merge($main_model_path, $sub_model_path);
?>
@foreach($main_path as $namespaces)
<?php
// Check if Duplicate name to explode it
$namespace_ex_model = explode('app', $namespaces);
// check if offset 2 not empty and exisist
if (isset($namespace_ex_model[2]) && !empty($namespace_ex_model[2])) {
$model_prefix = str_replace('/', '\\', 'App\\' . $namespace_ex_model[2]);
$model_prefix = str_replace('/', '\\', 'App\\'.$namespace_ex_model[2]);
} else {
$model_prefix = str_replace('/', '\\', 'App\\' . $namespace_ex_model[1]);
$model_prefix = str_replace('/', '\\', 'App\\'.$namespace_ex_model[1]);
}
$model_prefix = str_replace('\\\\', '\\', $model_prefix);
?>
@if(!preg_match('/Exceptions|Console|DataTables|it|ItHelpers|Mail|Http|Handlers|Providers/i',$model_prefix))
@if(!preg_match('/Exceptions|Console|DataTables|it|ItHelpers|Mail|Http|Handlers|Providers/i',$model_prefix))
<option value="{{$model_prefix}}"
{{ !empty($module_data) && $module_data->model_namespace == $model_prefix?'selected':'' }}
>{{$model_prefix}}</option>
@endif
@endforeach

</select>

</div>
</div>
<div class="col-md-12 well">
Expand All @@ -54,10 +61,10 @@
{{ !empty($module_data) && $module_data->admin_folder_path == 'resources/views' ?'selected':''}}
>resources/views</option>
@foreach( array_filter(glob(base_path('resources/views').'/*'), 'is_dir') as $admin_pathes)
<?php
$admin_path = 'resources' . explode('resources', $admin_pathes)[1];
<?php
$admin_path = 'resources'.explode('resources', $admin_pathes)[1];
?>
<option value="{{$admin_path}}"
<option value="{{$admin_path}}"
@if(!empty($module_data) )
{{ $module_data->admin_folder_path == $admin_path ?'selected':''}}
@else
Expand All @@ -77,7 +84,8 @@
<div class="form-group controller_name">
<label for="controller_name" class="col-md-12">{{it_trans('it.controller_name')}} -
<small>
<i class="fa fa-exclamation-triangle" style="width:10px;height:10px;color:orange;"></i>&nbsp; don't write <del style="color:red">ExampleController
<i class="fa fa-exclamation-triangle" style="width:10px;height:10px;color:orange;"></i>&nbsp;
don't write <del style="color:red">ExampleController
</del><i class="fa fa-times" style="color:red"></i>
write <b style="color:#090">Example
<i class="fa fa-check" style="width:10px;height:10px;color:green;"></i>
Expand All @@ -91,14 +99,14 @@
{{ !empty($module_data) && $module_data->controller_namespace == 'App\Http\Controllers'?'selected':'' }}
selected="selected">App\Http\Controllers</option> --}}
@foreach(array_filter(glob(app_path('Http/Controllers').'/*'), 'is_dir') as $namespaces)
<?php
<?php
// Check if Duplicate name to explode it
$ex_controller_path = explode('app', $namespaces);
// check if offset 2 not empty and exisist
if (isset($ex_controller_path[2]) && !empty($ex_controller_path[2])) {
$controller_namespace_prefix = str_replace('/', '\\', 'App\\' . $ex_controller_path[2]);
$controller_namespace_prefix = str_replace('/', '\\', 'App\\'.$ex_controller_path[2]);
} else {
$controller_namespace_prefix = str_replace('/', '\\', 'App\\' . $ex_controller_path[1]);
$controller_namespace_prefix = str_replace('/', '\\', 'App\\'.$ex_controller_path[1]);
}
$controller_namespace_prefix = str_replace('\\\\', '\\', $controller_namespace_prefix);
?>
Expand Down

0 comments on commit 8e43961

Please sign in to comment.