notification
This commit is contained in:
@ -43,6 +43,11 @@ class CardTransaction extends Model
|
||||
];
|
||||
}
|
||||
|
||||
public function fromCard(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Card::class, ownerKey: "from");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
|
@ -27,32 +27,12 @@ $table = new ListEloquentTable(new EloquentDataProvider(\kernel\app_modules\card
|
||||
'baseUrl' => "/admin/card_transaction"
|
||||
]));
|
||||
|
||||
|
||||
//$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->beforePrint(function () {
|
||||
return IconBtnCreateWidget::create(['url' => '/admin/card_transaction/create'])->run();
|
||||
$count = \kernel\app_modules\card\models\CardTransaction::all()->count();
|
||||
$html = IconBtnCreateWidget::create(['url' => '/admin/card_transaction/create'])->run();
|
||||
$html .= "<div>Всего записей: $count</div>";
|
||||
|
||||
return $html;
|
||||
});
|
||||
|
||||
$table->columns([
|
||||
@ -61,7 +41,28 @@ $table->columns([
|
||||
return \kernel\app_modules\card\models\CardTransaction::getStatus()[$data];
|
||||
}
|
||||
],
|
||||
|
||||
'from' => [
|
||||
'value' => function ($data) {
|
||||
if ((int)$data === 1001){
|
||||
$username = "System";
|
||||
}
|
||||
else {
|
||||
$username = Card::find($data)->username ?? '';
|
||||
}
|
||||
return $username;
|
||||
}
|
||||
],
|
||||
'to' => [
|
||||
'value' => function ($data) {
|
||||
if ((int)$data === 1001){
|
||||
$username = "System";
|
||||
}
|
||||
else {
|
||||
$username = Card::find($data)->username ?? '';
|
||||
}
|
||||
return $username;
|
||||
}
|
||||
],
|
||||
]);
|
||||
|
||||
$table->addAction(function($row) {
|
||||
|
Reference in New Issue
Block a user