Builder Pattern Method Chaining 2
public function index(Request $request)
{
$entries = (new ReportService())
->setYear(2020)
->getTransactionReport($request->input('project'));
// ... Other code
Builder Pattern Method Chaining 2
public function index(Request $request)
{
$entries = (new ReportService())
->setYear(2020)
->getTransactionReport($request->input('project'));
// ... Other code
Builder Pattern Method Chaining 1
class ReportService {
private $year;
public function setYear($year)
{
$this->year = $year;
return $this;
}
public function getTransactionReport(int $projectId = NULL)
{
$q = Transaction::with('project')
->with('transaction_type')
->with('income_source')
->with('currency')
->whereYear('transaction_date', $this->year)
->orderBy('transaction_date', 'desc');
// ... Other code
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us