mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-11 21:52:35 +01:00
23 lines
1.1 KiB
PHP
Executable File
23 lines
1.1 KiB
PHP
Executable File
<?php
|
|
|
|
class ActivityController extends \BaseController {
|
|
|
|
public function getDatatable($clientPublicId)
|
|
{
|
|
$query = DB::table('activities')
|
|
->join('clients', 'clients.id', '=', 'activities.client_id')
|
|
->where('clients.public_id', '=', $clientPublicId)
|
|
->where('activities.account_id', '=', Auth::user()->account_id)
|
|
->select('activities.message', 'activities.created_at', 'activities.currency_id', 'activities.balance', 'activities.adjustment');
|
|
|
|
|
|
return Datatable::query($query)
|
|
->addColumn('date', function($model) { return Utils::timestampToDateTimeString(strtotime($model->created_at)); })
|
|
->addColumn('message', function($model) { return $model->message; })
|
|
->addColumn('balance', function($model) { return Utils::formatMoney($model->balance, $model->currency_id); })
|
|
->addColumn('adjustment', function($model) { return $model->adjustment != 0 ? Utils::formatMoney($model->adjustment, $model->currency_id) : ''; })
|
|
->orderColumns('date')
|
|
->make();
|
|
}
|
|
|
|
} |