PHP code example of codeartlv / joona

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

    

codeartlv / joona example snippets



class JoonaServiceProvider extends JoonaPanelProvider
{

	protected function configure(Panel $panel): void
	{
		$panel
			->addViteResources([
				'resources/backend/scss/main.scss',
				'resources/backend/js/main.js'
			]
		);
	}

}

Route::middleware(['admin.web'])->group(function(){
    Route::get('/set-region', [ExampleController::class, 'action']);
});

Route::middleware(['admin.auth'])->group(function(){
    Route::get('/blog', [ExampleController::class, 'action']);
});

Route::middleware(['admin.web'])->group(function(){
    // Unauthenticated routes
    Route::middleware(['admin.auth'])->group(function () {
        // Authenticated routes
    });
});

use Codeart\Joona\View\Components\Form\FormResponse;

// Inside your controller
$form = new FormResponse();

// Form submitted successfully
$form->setSuccess('Data saved!');

// Set error on field
$form->setError('Value  to the URL
$form->setAction('close_popup', true); // Closes opened modal dialog
$form->setAction('reset', true); // Resets form to default state.

// Attaching additional data
$form->addData(['id'  =>  1]);

// Render form
return response()->json($form);
html
<x-button
	caption="Submit"
	type="submit"
	role="primary"
	icon="check"
	:attr="['custom-attribute'  =>  'yes']" />