Skip to content

Commit d6dbc26

Browse files
committed
wip
1 parent 5d2a79c commit d6dbc26

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

resources/views/resources/relation.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</h2>
77
<div class="app-card__actions">
88
@if($abilities['create'])
9-
<a href="{{ $createUrl }}" class="btn btn--primary btn--icon" data-turbo-frame="_top">
9+
<a href="{{ $baseUrl }}/create" class="btn btn--primary btn--icon" data-turbo-frame="_top">
1010
<x-root::icon name="plus" class="btn__icon" />
1111
{{ __('Add :resource', ['resource' => $modelName]) }}
1212
</a>

src/Fields/Relation.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,6 @@ public function toSubResource(Request $request, Model $model): array
927927
{
928928
return array_merge($this->toArray(), [
929929
'key' => $this->modelAttribute,
930-
'createUrl' => sprintf('%s/create', $this->modelUrl($model)),
931930
'baseUrl' => $this->modelUrl($model),
932931
'url' => URL::query($this->modelUrl($model), $this->parseQueryString($request->fullUrl())),
933932
'modelName' => $this->getRelatedName(),

src/Root.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Root
2424
*
2525
* @var string
2626
*/
27-
public const VERSION = '2.5.2';
27+
public const VERSION = '2.5.3';
2828

2929
/**
3030
* The registered booting callbacks.

src/RootServiceProvider.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Cone\Root;
44

5+
use Cone\Root\Exceptions\ResourceResolutionException;
56
use Cone\Root\Exceptions\SaveFormDataException;
67
use Cone\Root\Models\Medium;
78
use Cone\Root\Models\User;
@@ -25,6 +26,7 @@
2526
use Illuminate\Support\Facades\RateLimiter;
2627
use Illuminate\Support\Facades\Redirect;
2728
use Illuminate\Support\ServiceProvider;
29+
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
2830

2931
class RootServiceProvider extends ServiceProvider
3032
{
@@ -142,7 +144,11 @@ protected function registerRoutes(): void
142144
$root = $this->app->make(Root::class);
143145

144146
$this->app['router']->bind('resource', function (string $key) use ($root): Resource {
145-
return $root->resources->resolve($key);
147+
try {
148+
return $root->resources->resolve($key);
149+
} catch (ResourceResolutionException $exception) {
150+
throw new NotFoundHttpException();
151+
}
146152
});
147153

148154
$this->app['router']->bind('resourceModel', function (string $id, Route $route): Model {

0 commit comments

Comments
 (0)