mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-22 17:32:14 +00:00
Create invoice form part 1.
This commit is contained in:
@@ -1,29 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Oasis;
|
||||
|
||||
use App\Models\User;
|
||||
use Auth;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Str;
|
||||
use Laravel\Scout\Searchable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use TeamTNT\TNTSearch\Indexer\TNTIndexer;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Invoice extends Model
|
||||
{
|
||||
use HasFactory, Searchable;
|
||||
|
||||
protected $casts = [
|
||||
'items' => 'array',
|
||||
'user' => 'array',
|
||||
'items' => 'array',
|
||||
'user' => 'array',
|
||||
'client' => 'array',
|
||||
];
|
||||
|
||||
public $guarded = [
|
||||
'id'
|
||||
'id',
|
||||
];
|
||||
|
||||
public $incrementing = false;
|
||||
@@ -47,10 +45,10 @@ class Invoice extends Model
|
||||
$client_name = Str::slug($array['client']['name'], ' ');
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'clientName' => $array['client']['name'],
|
||||
'clientNameNgrams' => utf8_encode((new TNTIndexer)->buildTrigrams(implode(', ', [$client_name]))),
|
||||
'invoiceNumber' => $array['invoice_number'],
|
||||
'id' => $this->id,
|
||||
'clientName' => $array['client']['name'],
|
||||
'clientNameNgrams' => utf8_encode((new TNTIndexer)->buildTrigrams(implode(', ', [$client_name]))),
|
||||
'invoiceNumber' => $array['invoice_number'],
|
||||
'invoiceNumberNgrams' => utf8_encode((new TNTIndexer)->buildTrigrams(implode(', ', [$array['invoice_number']]))),
|
||||
];
|
||||
}
|
||||
@@ -60,7 +58,7 @@ class Invoice extends Model
|
||||
parent::boot();
|
||||
|
||||
static::creating(function ($invoice) {
|
||||
$invoice->id = (string)Str::uuid();
|
||||
$invoice->id = (string) Str::uuid();
|
||||
|
||||
$invoice->delivery_at = $invoice->created_at;
|
||||
$invoice->due_at = Carbon::parse($invoice->created_at)->addWeeks(2);
|
||||
|
||||
Reference in New Issue
Block a user