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

22 lines
1.2 KiB
PHP
Raw Normal View History

2013-11-29 13:09:21 +01:00
<?php
2015-01-11 13:30:08 +01:00
class ActivityController extends \BaseController
{
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)
2014-05-25 20:38:40 +02:00
->select('activities.id', 'activities.message', 'activities.created_at', 'clients.currency_id', 'activities.balance', 'activities.adjustment');
2015-01-11 13:30:08 +01:00
2013-12-30 21:17:45 +01:00
return Datatable::query($query)
2014-02-18 22:56:18 +01:00
//->addColumn('blank', function($model) { return ''; })
2015-01-11 13:30:08 +01:00
->addColumn('id', function ($model) { return Utils::timestampToDateTimeString(strtotime($model->created_at)); })
->addColumn('message', function ($model) { return Utils::decodeActivity($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) : ''; })
->make();
}
}