feat: Add change orders system with client approval/rejection and integrate with client portal
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class ChangeOrder extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'project_id',
|
||||
'title',
|
||||
'description',
|
||||
'amount',
|
||||
'status',
|
||||
'requested_at',
|
||||
'responded_at',
|
||||
'responded_by',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'requested_at' => 'date',
|
||||
'responded_at' => 'date',
|
||||
'amount' => 'decimal:2',
|
||||
];
|
||||
|
||||
public function project(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Project::class);
|
||||
}
|
||||
|
||||
public function responder(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'responded_by');
|
||||
}
|
||||
}
|
||||
@@ -8,16 +8,22 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class Project extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'name', 'address', 'lat', 'lng', 'start_date', 'end_date_estimated', 'status', 'created_by'
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'start_date' => 'date',
|
||||
'end_date_estimated' => 'date',
|
||||
"start_date" => "date",
|
||||
"end_date_estimated" => "date",
|
||||
];
|
||||
|
||||
public function changeOrders()
|
||||
{
|
||||
return $this->hasMany(ChangeOrder::class);
|
||||
}
|
||||
|
||||
// Relationships
|
||||
public function phases()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user