PHP code example of jecovier / laravel-inertia-routes
1. Go to this page and download the library: Download jecovier/laravel-inertia-routes 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/ */
jecovier / laravel-inertia-routes example snippets
/**
* /resources/js/Pages/folder/component.vue
* http://your-domain.com/folder/component
*/
InertiaRoute::get('folder/component');
/**
* Change route:
* /resources/js/Pages/folder/component.vue
* http://your-domain.com/about
*/
InertiaRoute::get('about', 'folder/component');
/**
* Automatically:
* /resources/js/Pages/folder/component.vue
* http://your-domain.com/folder/component
*/
InertiaRoute::bind('folder');
// change framework
InertiaRoute::vue();
InertiaRoute::react();
InertiaRoute::svelte();
/**
* /resources/js/Pages/folder/component.vue
* http://your-domain.com/folder/component
*/
InertiaRoute::get('folder/component');
/**
* Change route:
* /resources/js/Pages/folder/component.vue
* http://your-domain.com/about
*/
InertiaRoute::get('about', 'folder/component');
InertiaRoute::get('/', 'folder/component');
InertiaRoute::get('folder/component');
InertiaRoute::post('folder/component');
InertiaRoute::put('folder/component');
InertiaRoute::delete('folder/component');
InertiaRoute::patch('folder/component');
InertiaRoute::bind('some/folder/');
InertiaRoute::bind('you/route', 'some/folder/');
InertiaRoute::get('/route/{name}', 'folder/component');
InertiaRoute::get('folder/component/{name}');
InertiaRoute::get('/route/{parameter}', 'folder/component')
->middleware('validateParameter')
->can('viewThis');
InertiaRoute::react();
InertiaRoute::get('path/to/component/{parameter}');
InertiaRoute::svelte();
InertiaRoute::get('path/to/component/{parameter}');
InertiaRoute::root('your/new/path');