. */ /** * An interface to the assignment table in the database */ class Assignment extends Model implements Calculatable { use StandardCalculatable; public $table = 'assignment', $fillable_columns = ['offerId', 'title', 'description', 'hours', 'price_per_hour', 'VAT_percentage']; /** * Get the offer that this assignment is linked to * * @return offer The offer */ public function getOffer() { return new Offer($this->pdo, $this->offerId); } /** * The description after having parsed markdown * * @return string The description in HTML format */ public function getHTMLDescription() { $pd = new Parsedown; return $pd->text($this->description); } public function calculateSubtotal() { return $this->hours * $this->price_per_hour; } public function calculateVAT() { return $this->calculateSubtotal() * $this->VAT_percentage / 100; } }