mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-29 11:15:58 +00:00
added invoice profile
This commit is contained in:
@@ -37,11 +37,6 @@ class Invoice extends Model
|
||||
return $this->hasOne(Client::class, 'id', 'user_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Index file
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toSearchableArray()
|
||||
{
|
||||
$array = $this->toArray();
|
||||
@@ -72,24 +67,6 @@ class Invoice extends Model
|
||||
$invoice->total_tax = invoice_total_tax($invoice);
|
||||
|
||||
$invoice->currency = 'CZK';
|
||||
|
||||
$user = Auth::user() ?? User::find($invoice->user_id);
|
||||
|
||||
$invoice->author_name = $user->settings->name ?? null;
|
||||
$invoice->author_stamp = ''; // TODO: doplnit
|
||||
|
||||
$invoice->user = [
|
||||
'name' => $user->settings->name ?? null,
|
||||
'address' => $user->settings->address ?? null,
|
||||
'state' => $user->settings->state ?? null,
|
||||
'city' => $user->settings->city ?? null,
|
||||
'postal_code' => $user->settings->postcode ?? null,
|
||||
'country' => $user->settings->country ?? null,
|
||||
'phone_number' => $user->settings->phoneNumber ?? null,
|
||||
'bank_name' => $user->settings->bank_name ?? null,
|
||||
'iban' => $user->settings->iban ?? null,
|
||||
'swift' => $user->settings->swift ?? null,
|
||||
];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Oasis;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class InvoiceProfile extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public $guarded = ['id'];
|
||||
|
||||
public $incrementing = false;
|
||||
|
||||
protected $keyType = 'string';
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->hasOne(User::class, 'id', 'user_id');
|
||||
}
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::creating(function ($invoice) {
|
||||
$invoice->id = (string) Str::uuid();
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user