PHP code example of viewflex / ligero
1. Go to this page and download the library: Download viewflex/ligero 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/ */
viewflex / ligero example snippets
Viewflex\Ligero\LigeroServiceProvider::class,
$data = (new Publisher($config, $request))->getData();
namespace Viewflex\Ligero\Publish\Demo\Items;
use Viewflex\Ligero\Base\BasePublisherController;
class ItemsController extends BasePublisherController
{
public function __construct()
{
$this->createPublisherWithDefaults();
$this
->setDomain('Items')
->setTranslationFile('items')
->setTableName('ligero_items')
->setModelName('Viewflex\Ligero\Publish\Demo\Items\Item')
->setResultsColumns([
'id',
'active',
'name',
'category',
'subcategory',
'description',
'price'
])
->setWildcardColumns([
'category'
])
->setControls([
'pagination' => true,
'keyword_search' => true
])
->setKeywordSearchColumns([
'name',
'category',
'subcategory',
'description'
])
->setQueryRules([
'active' => 'boolean',
'name' => 'max:60',
'category' => 'max:25',
'subcategory' => 'max:25'
])
->setRequestRules([
'active' => 'boolean',
'name' => 'max:60',
'category' => 'max:25',
'subcategory' => 'max:25',
'description' => 'max:250',
'price' => 'numeric'
]);
}
}
Route::get('ligero/items/json', array('as' => 'ligero.items.json', 'uses' => '\Viewflex\Ligero\Publish\Demo\Items\ItemsController@json', 'middleware' => 'web'));
Route::get('ligero/items/action', array('as' => 'ligero.items.action', 'uses' => '\Viewflex\Ligero\Publish\Demo\Items\ItemsController@action', 'middleware' => 'web'));
Route::get('ligero/items', array('as' => 'ligero.items.index', 'uses' => '\Viewflex\Ligero\Publish\Demo\Items\ItemsController@index', 'middleware' => 'web'));
Route::get('ligero/items/create', array('as' => 'ligero.items.create', 'uses' => '\Viewflex\Ligero\Publish\Demo\Items\ItemsController@create', 'middleware' => 'web'));
Route::get('ligero/items/{id}', array('as' => 'ligero.items.show', 'uses' => '\Viewflex\Ligero\Publish\Demo\Items\ItemsController@show', 'middleware' => 'web'));
Route::get('ligero/items/{id}/edit', array('as' => 'ligero.items.edit', 'uses' => '\Viewflex\Ligero\Publish\Demo\Items\ItemsController@edit', 'middleware' => 'web'));
Route::post('ligero/items/store', array('as' => 'ligero.items.store', 'uses' => '\Viewflex\Ligero\Publish\Demo\Items\ItemsController@store', 'middleware' => 'web'));
Route::put('ligero/items/{id}', array('as' => 'ligero.items.update', 'uses' => '\Viewflex\Ligero\Publish\Demo\Items\ItemsController@update', 'middleware' => 'web'));
Route::delete('ligero/items/{id}', array('as' => 'ligero.items.destroy', 'uses' => '\Viewflex\Ligero\Publish\Demo\Items\ItemsController@destroy', 'middleware' => 'web'));
bash
php artisan vendor:publish --tag='ligero-routes'
bash
php artisan vendor:publish --tag='ligero-config'
bash
php artisan vendor:publish --tag='ligero-resources'
bash
php artisan vendor:publish --tag='ligero-data'
bash
php artisan migrate
bash
php artisan db:seed --class="LigeroSeeder"
bash
php artisan vendor:publish --tag='ligero'