public function __construct($organisationId) { parent::__construct(); $this->organisation = ModelOrganisation::getById($organisationId); if (!$this->organisation->hasRow()) { $this->setError(lang('Organisation not found')); redirect(url('admin.payment')); } $this->startDate = $this->input('start_date', date('Y-m-01', strtotime('-1 month'))); $this->endDate = $this->input('end_date', date('Y-m-t', strtotime('-1 month'))); $this->settings = ModelSettings::getInstance(); $this->payments = ModelPayment::getByOrganisationPeriod($this->organisation->id, $this->startDate, $this->endDate); $this->chargeCustomer(); $this->markPayed(); }
protected function hasPayed(ModelOrganisation $organisation) { return ModelPayment::getByOrganisationPeriod($organisation->id, $this->startDate, $this->endDate)->hasRow(); }