PHP code example of farsi / inertia-content

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

    

farsi / inertia-content example snippets


use Farsi\InertiaContent\Facades\Content;

Route::get('/docs/{path?}', function ($path = 'index') {
    return Content::pageOrFail("docs/$path");
})->where('path', '.*');

use Farsi\InertiaContent\Facades\Content;

// Find a single entry
$entry = Content::find('docs/intro');

// Check if content exists
if (Content::exists('docs/intro')) {
    // ...
}

// Query multiple entries
$entries = Content::query()
    ->where('_dir', 'docs')
    ->where('draft', false)
    ->orderBy('order', 'asc')
    ->get();

// Get navigation tree
$nav = Content::navigation('docs');

return [
    'content_dir' => resource_path('content'),
    'manifest_path' => public_path('build/inertia-content-manifest.json'),
    'show_drafts' => env('INERTIA_CONTENT_SHOW_DRAFTS', false),
    'default_component' => 'Content/Page',
    // ... more options
];