PHP code example of yurba / cmf

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

    

yurba / cmf example snippets


use Yurba\Cmf\Facades\Yurba;

Yurba::authorizeUsing(fn ($user) => $user->is_admin);

namespace App\Admin;

use App\Models\Post;
use Yurba\Cmf\Fields\Text;
use Yurba\Cmf\Fields\Editor;
use Yurba\Cmf\Fields\Slug;
use Yurba\Cmf\Resources\Resource;

class PostResource extends Resource
{
    public static string $model = Post::class;

    public function fields(): array
    {
        return [
            Text::make('title')->searchable()->sortable()->rules('

// config/yurba.php
'ui' => [
    // the panel's icons, by the Material Symbols name they replace
    'icon_html' => ['edit' => '<svg viewBox="0 0 24 24" width="20" height="20">…</svg>'],
    // YurbaPV's icons: left, right, close, zoom, zoomOut, rotate, download
    'viewer_icons' => [],
],
'editor' => [
    // YurbaEditor's icons, by its own keys
    'icons' => [],
],

use Yurba\Cmf\Translations\HasTranslations;

class Post extends Model
{
    use HasTranslations;
}

// in the resource
Text::make('title')->translatable();

// on the frontend
$post->tr('title');
bash
composer update yurba/cmf
php artisan vendor:publish --tag=yurba-assets --force
php artisan migrate