PHP code example of mehediishere / laravel-modular
1. Go to this page and download the library: Download mehediishere/laravel-modular library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Mehediishere\LaravelModular\Services\SidebarManager;
// Flush for the current user (call after role/permission changes)
app(SidebarManager::class)->flush();
// Flush for a specific user
app(SidebarManager::class)->flush($userId);
// Flush for all users
app(SidebarManager::class)->flushAll();
// Modules/POS/config/config.php
return ['per_page' => 25, 'currency' => 'BDT'];
// Anywhere in the app
config('pos.per_page'); // 25
config('pos.currency'); // BDT
// Fire from Order module
event(new \Modules\Order\app\Events\OrderPlaced($order));
// Listen in Inventory module's ServiceProvider boot()
\Illuminate\Support\Facades\Event::listen(
\Modules\Order\app\Events\OrderPlaced::class,
\Modules\Inventory\app\Listeners\ReserveStock::class,
);
// Define interface in the consuming module
// Modules/Order/app/Contracts/ProductStockInterface.php
// Implement in Product module
// Modules/Product/app/Services/ProductStockService.php
// Bind in Product's ServiceProvider
protected array $bindings = [
\Modules\Order\app\Contracts\ProductStockInterface::class =>
\Modules\Product\app\Services\ProductStockService::class,
];