1. Go to this page and download the library: Download estudia/inertia-uno 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/ */
estudia / inertia-uno example snippets
namespace App\Http\Controllers;
use Inertia\Inertia;
class TestController extends Controller
{
public function __invoke()
{
return Inertia::render('Test', [
'model' => [
"title": "Lorem ipsum dolor sit amet, consectetur adipiscing elit",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
],
]);
}
}
use App\Http\Controllers\TestController;
use Illuminate\Support\Facades\Route;
Route::get('/test', TestController::class);
bash
php artisan inertia-uno:install
bash
php artisan make:controller TestController
javascript
import { computed } from 'vue';
import { usePage } from '@inertiajs/vue3';
export default function useModel() {
const page = usePage();
const model = computed(() => page.props.model);
async function get() {
// Perform additional asynchronous work if needed
}
return { get, model };
}