Update checkout, enable editing of checkout, show details on invoices

This commit is contained in:
Deon George
2022-07-29 16:06:19 +10:00
parent 4f7a27dd8d
commit 39ded93a42
17 changed files with 434 additions and 52 deletions

View File

@@ -2,33 +2,43 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Leenooks\Traits\ScopeActive;
class Checkout extends Model
{
protected $table = 'ab_checkout';
public $timestamps = FALSE;
use ScopeActive;
protected $casts = [
'plugin_data'=>'json',
];
/* RELATIONS */
public function payments()
{
return $this->hasMany(Payment::class);
}
/** SCOPES **/
/* STATIC METHODS */
/**
* Search for a record
*
* @param $query
* @param string $term
* @return
*/
public function scopeActive($query)
public static function available(): Collection
{
return $query->where('active',TRUE);
return self::active()->get();
}
/** FUNCTIONS **/
/* ATTRIBUTES */
public function getIconAttribute(): string
{
switch(strtolower($this->name)) {
case 'paypal': return 'fab fa-cc-paypal';
default: return 'fas fa-money-bill-alt';
}
}
/* METHODS */
public function fee(float $amt,int $items=1): float
{