customer = $customer; $this->invoice = $invoice; $this->invoice_detail = $invoice_detail; $this->product = $product; $this->receipt = $receipt; $this->bank_account = $bank_account; $this->coa = $coa; } /** * Returns count of account. * * @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.customer.gadget', $count = 10) { if (User::hasRole('user')) { $this->customer->pushCriteria(new \Litepie\Bixo\Repositories\Criteria\CustomerUserCriteria()); } $customer = $this->customer->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('account::' . $view, compact('customer'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.invoice.gadget', $count = 10) { if (User::hasRole('user')) { $this->invoice->pushCriteria(new \Litepie\Bixo\Repositories\Criteria\InvoiceUserCriteria()); } $invoice = $this->invoice->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('account::' . $view, compact('invoice'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.invoice_detail.gadget', $count = 10) { if (User::hasRole('user')) { $this->invoice_detail->pushCriteria(new \Litepie\Bixo\Repositories\Criteria\InvoiceDetailUserCriteria()); } $invoice_detail = $this->invoice_detail->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('account::' . $view, compact('invoice_detail'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.product.gadget', $count = 10) { if (User::hasRole('user')) { $this->product->pushCriteria(new \Litepie\Bixo\Repositories\Criteria\ProductUserCriteria()); } $product = $this->product->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('account::' . $view, compact('product'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.receipt.gadget', $count = 10) { if (User::hasRole('user')) { $this->receipt->pushCriteria(new \Litepie\Bixo\Repositories\Criteria\ReceiptUserCriteria()); } $receipt = $this->receipt->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('account::' . $view, compact('receipt'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.bank_account.gadget', $count = 10) { if (User::hasRole('user')) { $this->bank_account->pushCriteria(new \Litepie\Bixo\Repositories\Criteria\BankAccountUserCriteria()); } $bank_account = $this->bank_account->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('account::' . $view, compact('bank_account'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.coa.gadget', $count = 10) { if (User::hasRole('user')) { $this->coa->pushCriteria(new \Litepie\Bixo\Repositories\Criteria\CoaUserCriteria()); } $coa = $this->coa->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('account::' . $view, compact('coa'))->render(); } }