nang cap san sang import
This commit is contained in:
27
app/Models/Contract.php
Normal file
27
app/Models/Contract.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
#[Fillable(['product_id', 'customer_id', 'type', 'start_date', 'end_date', 'status', 'printed_at', 'signed_status'])]
|
||||
class Contract extends Model
|
||||
{
|
||||
public function product(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Product::class);
|
||||
}
|
||||
|
||||
public function customer(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Customer::class);
|
||||
}
|
||||
|
||||
public function feedbacks(): HasMany
|
||||
{
|
||||
return $this->hasMany(Feedback::class);
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
#[Fillable(['customer_id', 'customer_product_id', 'feedback_channel_id', 'assigned_to', 'title', 'content', 'status', 'current_department_id', 'is_escalated'])]
|
||||
#[Fillable(['customer_id', 'customer_product_id', 'contract_id', 'feedback_channel_id', 'assigned_to', 'title', 'content', 'status', 'current_department_id', 'is_escalated'])]
|
||||
class Feedback extends Model
|
||||
{
|
||||
public function customer(): BelongsTo
|
||||
@@ -21,6 +21,11 @@ class Feedback extends Model
|
||||
return $this->belongsTo(CustomerProduct::class, 'customer_product_id');
|
||||
}
|
||||
|
||||
public function contract(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Contract::class);
|
||||
}
|
||||
|
||||
public function feedbackChannel(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(FeedbackChannel::class);
|
||||
|
||||
21
app/Models/Handover.php
Normal file
21
app/Models/Handover.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
#[Fillable(['product_id', 'customer_id', 'handover_date', 'status', 'remark'])]
|
||||
class Handover extends Model
|
||||
{
|
||||
public function product(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Product::class);
|
||||
}
|
||||
|
||||
public function customer(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Customer::class);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ namespace App\Models;
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
#[Fillable(['name', 'description', 'status'])]
|
||||
class Product extends Model
|
||||
@@ -15,4 +16,19 @@ class Product extends Model
|
||||
->withPivot('purchase_date')
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function contracts(): HasMany
|
||||
{
|
||||
return $this->hasMany(Contract::class);
|
||||
}
|
||||
|
||||
public function handovers(): HasMany
|
||||
{
|
||||
return $this->hasMany(Handover::class);
|
||||
}
|
||||
|
||||
public function productServices(): HasMany
|
||||
{
|
||||
return $this->hasMany(ProductService::class);
|
||||
}
|
||||
}
|
||||
|
||||
18
app/Models/ProductService.php
Normal file
18
app/Models/ProductService.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
#[Fillable(['product_id', 'service_type', 'status', 'actual_collection_date', 'remark'])]
|
||||
class ProductService extends Model
|
||||
{
|
||||
protected $table = 'product_services';
|
||||
|
||||
public function product(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Product::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user