21-11-2025
This commit is contained in:
parent
fa2ebd457d
commit
07959c0ba2
113 changed files with 4730 additions and 898 deletions
58
app/Models/Partner.php
Normal file
58
app/Models/Partner.php
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class Partner extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'company_name',
|
||||
'slug',
|
||||
'type',
|
||||
'hub_id',
|
||||
'description',
|
||||
'logo_url',
|
||||
'is_active',
|
||||
'setup_completed',
|
||||
'setup_completed_at',
|
||||
'delivery_radius_km',
|
||||
'assembly_radius_km',
|
||||
'provision_fixed_amount',
|
||||
'provision_rate_percentage',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'is_active' => 'boolean',
|
||||
'setup_completed' => 'boolean',
|
||||
'setup_completed_at' => 'datetime',
|
||||
];
|
||||
|
||||
/**
|
||||
* Ein Partner (Händler/Makler) kann einem Hub zugeordnet sein.
|
||||
* Ein Hersteller ist evtl. "global" (hub_id = null).
|
||||
*/
|
||||
public function hub(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Hub::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ein Partner (Firma) kann mehrere User-Logins haben.
|
||||
*/
|
||||
public function users(): HasMany
|
||||
{
|
||||
return $this->hasMany(User::class);
|
||||
}
|
||||
|
||||
// TODO: Später die Beziehung zu Products hinzufügen
|
||||
// public function products(): HasMany
|
||||
// {
|
||||
// return $this->hasMany(Product::class);
|
||||
// }
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue