Algoriza Framework Description.
git clone https://github.com/ourcoteam/fr.git
cd fr
cp .env.example .env
Now edit your .env file and set your env parameters (Specially the database username/pass, database name)
composer install
- If found "contain a compatible set of packages" problems use the following command
composer install --ignore-platform-reqs
php artisan app:install
php artisan serve
npm install
npm run dev
npm run watch
See Modules\Acl\Database\Seeders\SeedAllPermissionsTableSeeder.php
- Go to
Modules/{moudle_name}/Config/config.php
- Add new array with name permissions
- Add new group in permissions array
- Example:
return [
'permissions' => [
'posts' => [ // group name
'view-posts', // permission name
'read-posts', // permission name
]
]
];
php artisan permissions:sync
Description:
- Add Multi Languages
- Manage Translation words using database
- Go to
Modules/Localization/Config/config.php
- Add new language inside array with key name languages
- Example:
return [
'languages' => [
'en' => [
'name' => 'English',
// 'dir' => 'ltr', // default ltr
'is_default' => true // default false
],
'ar' => [
'name' => 'اللغة العربية',
'dir' => 'rtl', // default ltr,
// 'is_default' => false // default false
],
]
];
Note:
- You must add at least one language, and give it
is_default => true
.
php artisan languages:seed
See Modules\Localization\README.md
See Modules\Setting\README.md
We using Laravel modules https://nwidart.com/laravel-modules/v6/introduction
php artisan module:make {module_name}
See Modules\Setting\Theme_Setting_README.md
php artisan make:theme
This command will ask you to enter theme name, CSS framework, js framework, and optional auth scaffolding.
use Qirolab\Theme\Theme;
// Set active theme
Theme::set('theme-name');
// Get current active theme
Theme::active();
// Get current parent theme
Theme::parent();
// Clear theme. So, no theme will be active
Theme::clear();
// Get theme path
Theme::path($path = 'views');
// output:
// /app-root-path/themes/active-theme/views
Theme::path($path = 'views', $themeName = 'admin');
// output:
// /app-root-path/themes/admin/views
Theme::getViewPaths();
// Output:
// [
// '/app-root-path/themes/admin/views',
// '/app-root-path/resources/views'
// ]
Register ThemeMiddleware
in app\Http\Kernel.php
:
protected $routeMiddleware = [
// ...
'theme' => \Qirolab\Theme\Middleware\ThemeMiddleware::class,
];
Examples for middleware usage:
// Example 1: set theme for a route
Route::get('/dashboard', 'DashboardController@index')
->middleware('theme:dashboard-theme');
// Example 2: set theme for a route-group
Route::group(['middleware'=>'theme:admin-theme'], function() {
// "admin-theme" will be applied to all routes defined here
});
// Example 3: set child and parent theme
Route::get('/dashboard', 'DashboardController@index')
->middleware('theme:child-theme,parent-theme');
To compile the theme assets, you need to run this command:
npm run dev --theme=theme-name
# or
npm run watch --theme=theme-name
# or
npm run production --theme=theme-name
We using this package: Laravel themer to more info.
To add config in your theme and use it from by laravel function -> config()
:
- Add new folder with name
config
in root theme - And add
config.php
file in this folder - Example:
themes/{theme_name}/config/config.php
- Now you able to use this by laravel config function
- Type prefix "theme_" before theme name
- Using Example:
config('theme_{theme_name}.key');
To add words translations in your theme and use it from by laravel function -> __()
, trans()
or @lang()
:
-
Add new folder with name
lang
in root theme -
And add folder your language in this folder [en, ar]
-
Example:
themes/{theme_name}/lang/en
-
And add your file in the folder
en
-
Now you able to use this by laravel trans function
-
Type prefix "theme_" before theme name
-
Using Example:
-
Add file with name view.php
-
themes/{theme_name}/lang/en/view.php
// view.php file
return [
'name' => 'Name'
];
__('theme_{theme_name}::view.name');
To add menu items from your module, you will have to use the hooks functionality
- Type this code in:
Modules\{your_module}\Providers\{your_module}ServiceProvider
@boot function
$aside_menu = view('{your_module}::components.aside_menu');
$aside_menu['order'] = 8; //The item order on the menu
app('hook')->set('aside_menu', $aside_menu, 'array');
- In the
aside_menu
view add your code to include it like the following
@can('view-{your_module}')
<div class="menu-item">
<a class="menu-link {{ active_route('{your_module}.index') }}" href="{{ fr_route('{your_module}.index') }}">
<span class="menu-icon">
<i class="fas fa-box fa-fw"></i>
</span>
<span class="menu-title">{{ __('widget::view.{your_module}') }}</span>
</a>
</div>
@endcan
Global hook support to type: object, array. type object is default
Type array Example: This example to add component from blog module to menu module: Type this code in: Modules\Blog\Providers\BlogServiceProvider @boot
$select_category_menu_components = view('blog::components.select_category_to_menu');
$select_post_menu_components = view('blog::components.select_post_to_menu');
app('hook')->set('menu_addables', $select_category_menu_components, 'array');
app('hook')->set('menu_addables', $select_post_menu_components, 'array');
Use hook in menu module -> in blade file, or controller:
// in blade file
@if (app('hook')->get('menu_addables'))
@foreach(app('hook')->get('menu_addables') as $componentView)
{!! $componentView !!}
@endforeach
@endif
Type object Example: Add this code in provider
$select_branch_component = // view(), html, text, json,... or any data
app('hook')->set('select_branch', $select_branch_component);
Use hook to any module in views, controller or any place in code
echo app('hook')->get('select_branch');
See Modules\Widget\README.md
See Modules\Widget\Sidebar.md