refactored widgets

This commit is contained in:
denisdulici
2019-12-29 03:01:19 +03:00
parent e41b56a5b0
commit 6052506fd0
23 changed files with 445 additions and 935 deletions

View File

@@ -2,32 +2,18 @@
namespace App\Widgets;
use Arrilot\Widgets\AbstractWidget;
use App\Abstracts\Widget;
use App\Models\Banking\Transaction;
class LatestExpenses extends AbstractWidget
class LatestExpenses extends Widget
{
/**
* The configuration array.
*
* @var array
*/
protected $config = [
'width' => 'col-md-4'
];
/**
* Treat this method as a controller action.
* Return view() or other content to display.
*/
public function run()
public function show()
{
//
$latest_expenses = Transaction::type('expense')->orderBy('paid_at', 'desc')->isNotTransfer()->take(5)->get();
$transactions = Transaction::with('category')->type('expense')->orderBy('paid_at', 'desc')->isNotTransfer()->take(5)->get();
return view('widgets.latest_expenses', [
'config' => (object) $this->config,
'latest_expenses' => $latest_expenses,
'transactions' => $transactions,
]);
}
}