1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Move from guarded models to fillable properties.. overcomes handling additional response parameters

This commit is contained in:
David Bomba 2019-06-26 14:04:10 +10:00
parent 879d87ea60
commit f01c038c6e
11 changed files with 167 additions and 22 deletions

View File

@ -39,7 +39,7 @@ class Client extends BaseModel
protected $appends = [
];
/*
protected $guarded = [
'id',
'updated_at',
@ -52,6 +52,37 @@ class Client extends BaseModel
'country',
'shipping_country'
];
*/
protected $fillable = [
'name',
'website',
'private_notes',
'industry_id',
'size_id',
'currency_id',
'address1',
'address2',
'city',
'state',
'postal_code',
'country_id',
'custom_value1',
'custom_value2',
'custom_value3',
'custom_value4,',
'shipping_address1',
'shipping_address2',
'shipping_city',
'shipping_state',
'shipping_postal_code',
'shipping_country_id',
'settings',
'payment_terms',
'vat_number',
'id_number',
];
/*
protected $with = [
'contacts',

View File

@ -35,8 +35,16 @@ class ClientContact extends Authenticatable
protected $dates = ['deleted_at'];
protected $guarded = [
'id',
protected $fillable = [
'first_name',
'last_name',
'phone',
'custom_value1',
'custom_value2',
'custom_value3',
'custom_value4',
'email',
'avatar',
];
protected $hidden = [

View File

@ -44,6 +44,20 @@ class Company extends BaseModel
protected $fillable = [
'name',
'logo',
'industry_id',
'address1',
'address2',
'city',
'state',
'postal_code',
'work_phone',
'work_email',
'country_id',
'subdomain',
'vat_number',
'id_number',
'size_id',
'settings',
];
protected $appends = [

View File

@ -48,6 +48,8 @@ class Invoice extends BaseModel
'partial_due_date',
'custom_value1',
'custom_value2',
'custom_value3',
'custom_value4',
'custom_taxes1',
'custom_taxes2',
'custom_text_value1',
@ -55,6 +57,7 @@ class Invoice extends BaseModel
'line_items',
'settings',
'client_id',
'footer',
];
protected $casts = [

View File

@ -27,8 +27,12 @@ class Payment extends BaseModel
const STATUS_PARTIALLY_REFUNDED = 5;
const STATUS_REFUNDED = 6;
protected $guarded = [
'id',
protected $fillable = [
'client_id',
'payment_type_id',
'amount',
'payment_date',
'transaction_reference'
];
public function client()

View File

@ -22,12 +22,20 @@ class Product extends BaseModel
use SoftDeletes;
use Filterable;
protected $guarded = [
'id',
'updated_at',
'created_at',
'deleted_at',
'q',
protected $fillable = [
'custom_value1',
'custom_value2',
'custom_value3',
'custom_value4',
'product_key',
'notes',
'cost',
'price',
'qty',
'tax_name1',
'tax_name2',
'tax_rate1',
'tax_rate2',
];
public function company()

View File

@ -20,8 +20,31 @@ class Quote extends BaseModel
use MakesHash;
use Filterable;
protected $guarded = [
'id',
protected $fillable = [
'client_id',
'quote_number',
'discount',
'is_amount_discount',
'po_number',
'quote_date',
'valid_until',
'line_items',
'settings',
'footer',
'public_note',
'private_notes',
'terms',
'tax_name1',
'tax_name2',
'tax_rate1',
'tax_rate2',
'custom_value1',
'custom_value2',
'custom_value3',
'custom_value4',
'amount',
'partial',
'partial_due_date',
];
protected $casts = [

View File

@ -52,8 +52,32 @@ class RecurringInvoice extends BaseModel
const RECURS_INDEFINITELY = -1;
protected $guarded = [
'id',
protected $fillable = [
'client_id',
'invoice_number',
'discount'
'is_amount_discount',
'po_number',
'invoice_date',
'due_date',
'line_items',
'settings',
'footer',
'public_notes'
'private_notes',
'terms',
'tax_name1',
'tax_name2',
'tax_rate1',
'tax_rate2',
'custom_value1',
'custom_value2',
'custom_value3',
'custom_value4',
'amount',
'partial'
'frequency_id'
'start_date',
];
protected $casts = [

View File

@ -51,8 +51,31 @@ class RecurringQuote extends BaseModel
const RECURS_INDEFINITELY = -1;
protected $guarded = [
'id',
protected $fillable = [
'client_id',
'quote_number',
'discount',
'is_amount_discount',
'po_number',
'quote_date',
'valid_until',
'line_items',
'settings',
'footer',
'public_note',
'private_notes',
'terms',
'tax_name1',
'tax_name2',
'tax_rate1',
'tax_rate2',
'custom_value1',
'custom_value2',
'custom_value3',
'custom_value4',
'amount',
'frequency_id',
'start_date',
];
protected $casts = [

View File

@ -18,8 +18,14 @@ class Task extends BaseModel
{
use MakesHash;
protected $guarded = [
'id',
protected $fillable = [
'client_id',
'invoice_id',
'custom_value1',
'custom_value2',
'description',
'is_running',
'time_log',
];
protected $appends = ['task_id'];

View File

@ -18,8 +18,9 @@ class TaxRate extends BaseModel
{
use MakesHash;
protected $guarded = [
'id',
protected $fillable = [
'name',
'rate'
];
protected $appends = ['tax_rate_id'];