Answer the question
In order to leave comments, you need to log in
How to arrange pivot in Laravel?
there is a Tariff model
class Tariff extends Model
{
use HasFactory;
protected $table = 'tariffs';
public function permissions()
{
return $this->belongsToMany(TariffPermission::class,'permission_tariffs','tariff_permission_id','tariff_id');
}
}
class TariffPermission extends Model
{
use HasFactory;
protected $table = 'tariff_permissions';
}
class PermissionTariff extends Model
{
use HasFactory;
protected $table = 'permission_tariffs';
}
$tariffs = Tariff::with('permissions')->get();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question