past_transaction = $past_transaction; $this->transaction_file = $transaction_file; } /** * Returns count of transaction. * * @param array $filter * * @return int */ public function count() { return 0; } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.past_transaction.gadget', $count = 10) { if (User::hasRole('user')) { $this->past_transaction->pushCriteria(new \Litepie\Buyesrfolio\Repositories\Criteria\PastTransactionUserCriteria()); } $past_transaction = $this->past_transaction->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('transaction::' . $view, compact('past_transaction'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.transaction_file.gadget', $count = 10) { if (User::hasRole('user')) { $this->transaction_file->pushCriteria(new \Litepie\Buyesrfolio\Repositories\Criteria\TransactionFileUserCriteria()); } $transaction_file = $this->transaction_file->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('transaction::' . $view, compact('transaction_file'))->render(); } }