|
- <?php
-
- namespace App\Models;
-
- use Illuminate\Database\Eloquent\Factories\HasFactory;
- use Illuminate\Database\Eloquent\Model;
- use App\Models\Order;
- use App\Models\Supplier;
-
- class Service extends Model
- {
- use HasFactory;
-
- protected $fillable = [
- 'name', 'type', 'site', 'available'
- ];
-
- public function order() {
- return $this->hasMany(Order::class);
- }
-
- public function suppliers() {
- return $this->hasMany(Supplier::class);
- }
-
- public function primary() {
- return $this->belongsTo(Supplier::class, 'primary_supplier', 'id');
- }
-
- }
|