77 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			77 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						||
 | 
						||
/**
 | 
						||
 * @var \Illuminate\Database\Eloquent\Collection $gestalt_profile_relationship
 | 
						||
 * @var int $page_number
 | 
						||
 * @var \kernel\CgView $view
 | 
						||
 */
 | 
						||
 | 
						||
use kernel\app_modules\gestalt_profile_relationship\models\GestaltProfileRelationship;
 | 
						||
use Itguild\EloquentTable\EloquentDataProvider;
 | 
						||
use Itguild\EloquentTable\ListEloquentTable;
 | 
						||
use kernel\widgets\IconBtn\IconBtnCreateWidget;
 | 
						||
use kernel\widgets\IconBtn\IconBtnDeleteWidget;
 | 
						||
use kernel\widgets\IconBtn\IconBtnEditWidget;
 | 
						||
use kernel\widgets\IconBtn\IconBtnViewWidget;
 | 
						||
 | 
						||
$view->setTitle("Список gestalt_profile_relationship");
 | 
						||
$view->setMeta([
 | 
						||
    'description' => 'Список gestalt_profile_relationship системы'
 | 
						||
]);
 | 
						||
 | 
						||
//Для использования таблицы с моделью, необходимо создать таблицу в базе данных
 | 
						||
$table = new ListEloquentTable(new EloquentDataProvider(GestaltProfileRelationship::class, [
 | 
						||
    'currentPage' => $page_number,
 | 
						||
    'perPage' => 8,
 | 
						||
    'params' => ["class" => "table table-bordered", "border" => "2"],
 | 
						||
    'baseUrl' => "/admin/gestalt_profile_relationship"
 | 
						||
]));
 | 
						||
 | 
						||
 | 
						||
//$table = new \Itguild\Tables\ListJsonTable(json_encode(
 | 
						||
//    [
 | 
						||
//        'meta' => [
 | 
						||
//            'total' => 0,
 | 
						||
//            'totalWithFilters' => 0,
 | 
						||
//            'columns' => [
 | 
						||
//                'title',
 | 
						||
//                'slug',
 | 
						||
//                'status',
 | 
						||
//            ],
 | 
						||
//            'perPage' => 5,
 | 
						||
//            'currentPage' => 1,
 | 
						||
//            'baseUrl' => '/admin/some',
 | 
						||
//            'params' => [
 | 
						||
//                'class' => 'table table-bordered',
 | 
						||
//                'border' => 2
 | 
						||
//            ]
 | 
						||
//        ],
 | 
						||
//        'filters' => [],
 | 
						||
//        'data' => [],
 | 
						||
//    ]
 | 
						||
//));
 | 
						||
 | 
						||
// Пример фильтра
 | 
						||
$table->columns([
 | 
						||
    'gestalt_profile_id' => [
 | 
						||
        'value' => function ($data) {
 | 
						||
            return \kernel\app_modules\gestalt_profile\models\Gestalt_profile::find($data)->fio ?? '';
 | 
						||
        }
 | 
						||
    ],
 | 
						||
]);
 | 
						||
 | 
						||
//$table->beforePrint(function () {
 | 
						||
//    return IconBtnCreateWidget::create(['url' => '/admin/gestalt_profile_relationship/create'])->run();
 | 
						||
//});
 | 
						||
 | 
						||
$table->addAction(function($row) {
 | 
						||
    return IconBtnViewWidget::create(['url' => '/admin/gestalt_profile_relationship/view/' . $row['id']])->run();
 | 
						||
});
 | 
						||
//$table->addAction(function($row) {
 | 
						||
//    return IconBtnEditWidget::create(['url' => '/admin/gestalt_profile_relationship/update/' . $row['id']])->run();
 | 
						||
//});
 | 
						||
$table->addAction(function($row) {
 | 
						||
    return IconBtnDeleteWidget::create(['url' => '/admin/gestalt_profile_relationship/delete/' . $row['id']])->run();
 | 
						||
});
 | 
						||
$table->create();
 | 
						||
$table->render(); |