Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

nasirkhan/laravel-starter

1355 stars
4 code files
View nasirkhan/laravel-starter on GitHub

app/helpers.php

Open in GitHub
//
if (!function_exists('label_case')) {
 
/**
* Prepare the Column Name for Lables.
*/
function label_case($text)
{
$order = ['_', '-'];
$replace = ' ';
 
$new_text = trim(\Illuminate\Support\Str::title(str_replace('"', '', $text)));
$new_text = trim(\Illuminate\Support\Str::title(str_replace($order, $replace, $text)));
$new_text = preg_replace('!\s+!', ' ', $new_text);
 
return $new_text;
}
}
//

composer.json

Open in GitHub
{
//
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/",
"Modules\\": "Modules/"
},
"classmap": [
"app/Models"
],
"files": [
"app/helpers.php"
]
},
//
}

Modules/Tag/Resources/views/backend/tags/form.blade.php

Open in GitHub
<div class="row">
<div class="col-12 col-sm-4">
<div class="form-group">
<?php
$field_name = 'name';
$field_lable = label_case($field_name);
$field_placeholder = $field_lable;
$required = "required";
?>
{{ html()->label($field_lable, $field_name) }} {!! fielf_required($required) !!}
{{ html()->text($field_name)->placeholder($field_placeholder)->class('form-control')->attributes(["$required"]) }}
</div>
</div>
//
</div>

app/Http/Controllers/Backend/RolesController.php

Open in GitHub
use Log;
 
class RolesController extends Controller
{
public function index()
{
$module_title = $this->module_title;
$module_name = $this->module_name;
$module_path = $this->module_path;
$module_icon = $this->module_icon;
$module_model = $this->module_model;
$module_name_singular = Str::singular($module_name);
 
$module_action = 'List';
 
$$module_name = $module_model::with('permissions')->paginate();
 
Log::info(label_case($module_title.' '.$module_action).' | User:'.auth()->user()->name.'(ID:'.auth()->user()->id.')');
 
return view(
"backend.$module_path.index",
compact('module_title', 'module_name', "$module_name", 'module_icon', 'module_name_singular', 'module_action')
);
}
}

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.