Skip to content

Commit 3e46420

Browse files
committed
wip
1 parent 5d5f5dc commit 3e46420

File tree

3 files changed

+48
-45
lines changed

3 files changed

+48
-45
lines changed

composer.lock

Lines changed: 39 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/js/app.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ window.$http = Axios.create({
2626
// Cookie
2727
window.$cookie = new Cookie('__root_');
2828

29+
// Handle the relation frame load event
2930
document.addEventListener('relation-frame-loaded', (event) => {
3031
if (window.location.href !== event.detail.url) {
3132
window.history.replaceState(window.history.state, document.title, event.detail.url);

src/Fields/Relation.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -632,9 +632,10 @@ public function paginate(Request $request, Model $model): LengthAwarePaginator
632632
->withCount($this->withCount)
633633
->latest()
634634
->paginate(
635-
$request->input($this->getPerPageKey(), $request->isTurboFrameRequest()
636-
? 5
637-
: $relation->getRelated()->getPerPage())
635+
$request->input(
636+
$this->getPerPageKey(),
637+
$request->isTurboFrameRequest() ? 5 : $relation->getRelated()->getPerPage()
638+
)
638639
)->withQueryString();
639640
}
640641

@@ -875,9 +876,10 @@ public function routes(Router $router): void
875876
public function registerRouteConstraints(Request $request, Router $router): void
876877
{
877878
$router->bind($this->getRouteKeyName(), function (string $id, Route $route) use ($router): Model {
878-
return $id === 'create'
879-
? $this->getRelation($route->parentOfParameter($this->getRouteKeyName()))->make()
880-
: $this->resolveRouteBinding($router->getCurrentRequest(), $id);
879+
return match ($id) {
880+
'create' => $this->getRelation($route->parentOfParameter($this->getRouteKeyName()))->make(),
881+
default => $this->resolveRouteBinding($router->getCurrentRequest(), $id),
882+
};
881883
});
882884
}
883885

0 commit comments

Comments
 (0)