PHP code example of romkaltu / laravel-modules-inertia

1. Go to this page and download the library: Download romkaltu/laravel-modules-inertia 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/ */

    

romkaltu / laravel-modules-inertia example snippets


// In Modules/Fleet/Http/Controllers/TruckController.php

use Inertia\Inertia;

class TruckController extends Controller
{
    public function index()
    {
        return Inertia::render('Fleet/trucks/index', [
            'trucks' => Truck::all(),
        ]);
    }
}

return [
    /*
     * The absolute path to the modules directory.
     * When null, it's resolved from nwidart/laravel-modules config
     * (config('modules.paths.modules')), falling back to base_path('Modules').
     */
    'modules_path' => null,
];
bash
php artisan vendor:publish --tag=inertia-modules-config
bash
php artisan vendor:publish --tag=inertia-modules-stubs
bash
php artisan inertia-modules:sync
bash
php artisan inertia-modules:sync --write