Optimise users home page

This commit is contained in:
Deon George
2021-06-29 16:36:34 +10:00
parent 638472fb4f
commit bac4fd6227
34 changed files with 915 additions and 627 deletions

View File

@@ -4,12 +4,22 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Log;
use Illuminate\Http\Request;
use App\Interfaces\IDs;
use App\Traits\NextKey;
use Illuminate\Support\Facades\Log;
class Product extends Model
/**
* Class Product
* Products that are available to sale, and appear on invoices
*
* Attributes for products:
* + lid : Local ID for product (part number)
*
* @package App\Models
*/
class Product extends Model implements IDs
{
use NextKey;
const RECORD_ID = 'product';
@@ -97,6 +107,16 @@ class Product extends Model
return $this->description($this->getDefaultLanguage());
}
/**
* Product Local ID
*
* @return string
*/
public function getLIDattribute(): string
{
return sprintf('%04s',$this->id);
}
public function getMinimumCostAttribute()
{
$table = [
@@ -165,6 +185,16 @@ class Product extends Model
return Arr::get($this->price_array,sprintf('%s.1.price_setup',$this->price_recurr_default))*1.1;
}
/**
* Product System ID
*
* @return string
*/
public function getSIDattribute(): string
{
return sprintf('%02s-%s',$this->site_id,$this->getLIDattribute());
}
/**
* Return if this product captures usage data
*