Builder Pattern Method Chaining 1 code example
Example: 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