Trying to get property 'invoice_prefix' of non-object
@if (!isset($invoice))
<div ><b>OR</b></div>
<div >
<a href="#" > Select
Existing
Customer</a>
</div>
@endif
<div >
<div >
<span >#{{ $setting->invoice_prefix }}</span>
<input type="hidden" name="invoice_id_test" value="{{ isset($invoice) ? $invoice->id : '' }}" id="">
<input type="text" name="invoice_id" readonly id="invoice_id"
placeholder="Invoice Number" aria-describedby="sizing-addon1" value="{{ isset($invoice) ? $invoice->id : $setting->invoice_initial_value }}">
</div>
</div>
im getting ErrorException
CodePudding user response:
You are checking for the existence of $invoice
variable but your $setting
variable is probably empty, not existing, or not a type of object
Error is saying that invoice_prefix is not available inside $setting variable because is not a type of object. try to {{ dd($setting) }} somewhere in your code to see what is inside that variable.
If $setting is an array for example you can get value like follows:
$setting['invoice_prefix']
If is null then problem is that you not assign any value to that variable therefore you are trying access property 'invoice_prefix' of non-object