Downloads
Stars
Version
This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.
We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.
We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.
You can install the package via composer:
composer require mahmoud-mhamed/laravel-helpers
You can publish the config file with:
php artisan vendor:publish --tag="helpers-config"
#for replace old config if exist
php artisan vendor:publish --tag="helpers-config" --force
You can publish command create builder:
php artisan vendor:publish --tag="command-create-builder"
Command To Make New Enum File:
php artisan make:enum FileName
This is the contents of the published config file:
return [
/*
|--------------------------------------------------------------------------
| Model Trait Defaults
|--------------------------------------------------------------------------
|
| This option controls model trait
| format : Y-m-d h:i A | Y-m-d or any carbon format
| null_value : return value if date is null
| format_diff_for_human_when_less_than_or_equal_hour : convert value to diff for human if value less than or equal 24 H ,null if don't convert to diff for human
| format_diff_in_day_grater_than : date format if diff in day grater than 7 , null => use default format
|
*/
'model_date_trait' => [
'format' => 'Y-m-d h:i A',
'null_value' => '- - - -',
'format_diff_for_human_when_less_than_or_equal_hour' => 24,
'format_diff_in_day_grater_than' => [
'value' => 7,
'format' => 'Y-m-d',
],
],
/*
|--------------------------------------------------------------------------
| EnumOptionsTrait
|--------------------------------------------------------------------------
|
| trans_file_name : store trans file name
*/
'enum_options_trait' => [
'trans_file_name' => 'enums',
],
/*
|--------------------------------------------------------------------------
| Localization setting
|--------------------------------------------------------------------------
|
| local : all available local
| default : default value for local
| api-header-key : api-header-key for set local
*/
'localization' => [
'local' => ['ar', 'en'],
'default' => 'ar',
'api-header-key' => 'Content-Language',
],
];
Command To Make BaseModel File:
php artisan make:base-model
Command To Make BaseBuilder File:
php artisan make:base-builder
Command To Make Builder For Model:
php artisan make:builder ModelName
Command To Clone Enums From App Enum To js:
php artisan enums:clone-to-js
plugins: [
....
{
name: "enum_clone",
enforce: "post",
handleHotUpdate({ server, file }) {
if (file.includes("/app/Enums")) {
exec(
"php artisan enums:clone-to-js",
(error, stdout) =>
error === null &&
console.log(`Enum Js File Generated Successfully !`)
);
}
},
},
],
The MIT License (MIT). Please see License File for more information.