PHP code example of idealogica / lavanda
1. Go to this page and download the library: Download idealogica/lavanda 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/ */
idealogica / lavanda example snippets
Idealogica\Lavanda\LavandaServiceProvider::class
public static function buildListDescriptor(
\Idealogica\Lavanda\Descriptor\PresentationDescriptor $descriptor)
public static function buildListDescriptor(
\Idealogica\Lavanda\Descriptor\PresentationDescriptor $descriptor)
{
$descriptor->
add('id', 'text', '#', ['width' => '50px'])->
add('created_at', 'text', 'Date', ['width' => '120px'])->
add('title', 'text', 'Title', ['max_len' => 100])->
add('image', 'image', 'Image', ['width' => '140px', 'img_width' => 100]);
}
public function add($name, $type = 'text', $title = '', array $parms = [])
public function addQueryBuilder(\Closure $queryBuilder)
public static function buildItemDescriptor(
\Idealogica\Lavanda\Descriptor\PresentationDescriptor $descriptor)
public static function buildItemDescriptor(
\Idealogica\Lavanda\Descriptor\PresentationDescriptor $descriptor)
{
$descriptor->
add('id', 'text', '#')->
add('created_at', 'text', 'Date')->
add('title', 'text', 'Title')->
add('image', 'image', 'Image', [
'img_width' => 600])->
add('body', 'text', 'Text');
}
public static function buildActionsDescriptor(
\Idealogica\Lavanda\Descriptor\Descriptor $descriptor)
public static function buildActionsDescriptor(
\Idealogica\Lavanda\Descriptor\Descriptor $descriptor)
{
$descriptor->
add('create')->
add('edit')->
add('destroy');
}
public static function buildStorageDescriptor(
\Idealogica\Lavanda\Descriptor\StorageDescriptor $descriptor)
public static function buildStorageDescriptor(
\Idealogica\Lavanda\Descriptor\StorageDescriptor $descriptor)
{
$descriptor->
add('image', 'image', [
'path' => 'image/post',
'type' => 'jpg']);
}
public function add($name, $type = 'image', array $parms = [])
public static function buildSearchDescriptor(
\Idealogica\Lavanda\Descriptor\Descriptor $descriptor)
public static function buildSearchDescriptor(
\Idealogica\Lavanda\Descriptor\Descriptor $descriptor)
{
$descriptor->
add('id')->
add('title')->
add('body');
}
public static function buildSortDescriptor(
\Idealogica\Lavanda\Descriptor\SortDescriptor $descriptor)
public static function buildSortDescriptor(
\Idealogica\Lavanda\Descriptor\SortDescriptor $descriptor)
{
$descriptor->
add('id', '#')->
add('created_at', 'Date')->
add('title', 'Title');
}
public function add($name, $title = '')
public static function buildDeleteDescriptor(
\Idealogica\Lavanda\Descriptor\Descriptor $descriptor)
public static function buildDeleteDescriptor(
\Idealogica\Lavanda\Descriptor\Descriptor $descriptor)
{
$descriptor->
add('comments')->
add('tags');
}
public static function buildFormQuery(
\Illuminate\Database\Eloquent\Builder $query)
public static function buildFormQuery(
\Illuminate\Database\Eloquent\Builder $query)
{
$query->with('comments')->with('tags');
}
public static function buildForm(
\Kris\LaravelFormBuilder\Form $form, $config)
public static function buildForm(
\Kris\LaravelFormBuilder\Form $form, $config)
{
$form->
add('created_at', 'date', [
'label' => 'Date',
'rules' => 'quired|min:5',
' 'rules' => ' 'label' => 'Comments',
'row_label' => 'Comment']);
}
public static function getName()
public static function getPluralName()
public static function hasController()
public static function getItemsPerPage()
php artisan vendor:publish --provider 'Idealogica\Lavanda\LavandaServiceProvider' --tag=public
php artisan vendor:publish --provider 'Idealogica\Lavanda\LavandaServiceProvider' --tag=config
php artisan vendor:publish --provider 'Idealogica\Lavanda\LavandaServiceProvider' --tag=lang
php artisan vendor:publish --provider 'Idealogica\Lavanda\LavandaServiceProvider' --tag=views