1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 21:52:35 +01:00
invoiceninja/app/controllers/ActivityController.php

21 lines
1.1 KiB
PHP
Raw Normal View History

2013-11-29 13:09:21 +01:00
<?php
class ActivityController extends \BaseController {
2013-12-04 17:20:14 +01:00
public function getDatatable($clientPublicId)
2013-11-29 13:09:21 +01:00
{
2013-12-30 21:17:45 +01:00
$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');
2013-12-04 17:20:14 +01:00
2013-12-30 21:17:45 +01:00
return Datatable::query($query)
2014-01-08 00:59:06 +01:00
->addColumn('created_at', function($model) { return Utils::timestampToDateTimeString(strtotime($model->created_at)); })
2013-12-01 21:58:25 +01:00
->addColumn('message', function($model) { return $model->message; })
2013-12-30 21:17:45 +01:00
->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) : ''; })
2013-11-29 13:09:21 +01:00
->make();
}
}