🤩 File Manager - Mr.X
PHP:
8.3.33
Server:
Apache
OS:
Linux 5.14.0-611.49.1.el9_7.x86_64
User:
websparkit
Navigate
Upload:
Upload
New File
New Folder
Editing:Quotation.php
<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; class Quotation extends Model { protected $fillable = [ 'quotation_number', 'project_id', 'client_id', 'client_name', 'company_name', 'total_amount', 'discount', 'final_amount', 'notes', 'terms', 'status', 'sent_at', 'accepted_at', ]; protected $casts = [ 'total_amount' => 'decimal:2', 'discount' => 'decimal:2', 'final_amount' => 'decimal:2', 'sent_at' => 'datetime', 'accepted_at' => 'datetime', ]; public function project() { return $this->belongsTo(Project::class); } public function client() { return $this->belongsTo(User::class, 'client_id'); } public function items() { return $this->hasMany(QuotationItem::class); } public static function generateNumber(): string { $year = date('Y'); $last = self::whereYear('created_at', $year)->count() + 1; return 'QUO-' . $year . '-' . str_pad($last, 4, '0', STR_PAD_LEFT); } }
Save Changes
Cancel
Create New File
Create New Folder