35 lines
731 B
PHP
35 lines
731 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
class Order extends Model
|
|
{
|
|
use HasFactory;
|
|
// protected $table = 'orders';
|
|
|
|
protected $fillable = ['owner_id', 'kurir_id', 'recipient_name', 'address', 'description', 'status'];
|
|
|
|
// protected $attributes = [
|
|
// 'harga' => 15000, // Harga default per pesanan
|
|
// ];
|
|
|
|
public function getGajiKurirAttribute()
|
|
{
|
|
return 5000;
|
|
}
|
|
|
|
// Relasi ke tabel users (kurir)
|
|
public function owner()
|
|
{
|
|
return $this->belongsTo(User::class, 'owner_id');
|
|
}
|
|
public function kurir()
|
|
|
|
{
|
|
return $this->belongsTo(User::class, 'kurir_id');
|
|
}
|
|
}
|