Invoice.php 462 B

1234567891011121314151617181920
  1. <?php
  2. namespace App\Models;
  3. # use Illuminate\Database\Eloquent\Model;
  4. class Invoice extends Model
  5. {
  6. protected $table = 'invoice';
  7. public function displayName() {
  8. return '$' . $this->amount .
  9. ($this->description ? ' | ' . substr($this->description, 0, 15) : '') .
  10. ' | ' . friendly_date_time($this->created_at);
  11. }
  12. public function customer() {
  13. return $this->hasOne(Customer::class, 'id', 'customer_id');
  14. }
  15. }