Code improvements
This commit is contained in:
@@ -169,7 +169,7 @@ class Event extends InstancedModel
|
||||
public function paymentMethods() : BelongsToMany {
|
||||
// Pivot verknüpft über den Slug (payment_methods.slug), nicht über die numerische id
|
||||
// von available_payment_methods -- die tenant-spezifische Instanz wird dadurch implizit
|
||||
// über den globalen SiteScope von AvailablePaymentMethod (gefiltert auf app('tenant')) aufgelöst.
|
||||
// über den globalen SiteScope von AvailablePaymentMethod (gefiltert auf currentTenant()) aufgelöst.
|
||||
return $this->belongsToMany(AvailablePaymentMethod::class, 'event_payment_methods', 'event_id', 'slug', 'id', 'slug')
|
||||
->using(EventPaymentMethods::class)
|
||||
->withPivot('configuration')
|
||||
|
||||
@@ -50,7 +50,7 @@ class Tenant extends CommonModel
|
||||
}
|
||||
|
||||
public static function getTempDirectory() : string {
|
||||
return app('tenant')->slug . '/temp-data/';
|
||||
return currentTenant()->slug . '/temp-data/';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+3
-3
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
|
||||
@@ -115,10 +115,10 @@ class User extends Authenticatable
|
||||
}
|
||||
|
||||
public function localGroup() : Tenant {
|
||||
return $this->belongsTo(Tenant::class, 'local_group', 'slug')->first();
|
||||
return $this->belongsTo(Tenant::class, 'local_group', 'slug')->firstOrFail();
|
||||
}
|
||||
|
||||
public function costUnits()
|
||||
public function costUnits() : BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(CostUnit::class, 'cost_unit_treasurers', 'user_id', 'cost_unit_id')
|
||||
->withTimestamps();
|
||||
|
||||
Reference in New Issue
Block a user