File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55use App \Http \Controllers \Api \V1 \HealthController ;
66use App \Http \Controllers \Api \V1 \PingController ;
7+ use App \Restify \RoutesBoot as CustomRoutesBoot ;
78use Binaryk \LaravelRestify \Bootstrap \RoutesBoot ;
89use Binaryk \LaravelRestify \Restify ;
910use Binaryk \LaravelRestify \RestifyApplicationServiceProvider ;
@@ -41,6 +42,14 @@ protected function routes(): void
4142
4243 public function boot (): void
4344 {
45+ // Swap Restify's route booter for one that omits the built-in
46+ // default routes (profile, global search, restifyjs/setup). The only
47+ // v1 routes should be those we explicitly add: registered
48+ // repositories and our own custom controllers (ping/health). This
49+ // must be bound before parent::boot() triggers route registration,
50+ // and persists for the RestifyInjector middleware at request time.
51+ $ this ->app ->bind (RoutesBoot::class, CustomRoutesBoot::class);
52+
4453 parent ::boot ();
4554
4655 // No model repositories are registered yet. Add repository classes
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace App \Restify ;
4+
5+ use Binaryk \LaravelRestify \Bootstrap \RoutesBoot as BaseRoutesBoot ;
6+ use Binaryk \LaravelRestify \Bootstrap \RoutesDefinition ;
7+ use Illuminate \Support \Facades \Route ;
8+
9+ /**
10+ * Customized Restify route booter.
11+ *
12+ * The base class registers a set of built-in, non-repository endpoints
13+ * (profile, global search, restifyjs/setup) via RoutesDefinition::once().
14+ * We don't want those: the only v1 routes should be the ones we explicitly
15+ * add (registered repositories and our own custom controllers ).
16+ * This override registers the per-repository CRUD routes but
17+ * skips once().
18+ */
19+ class RoutesBoot extends BaseRoutesBoot
20+ {
21+ public function defaultRoutes ($ config ): self
22+ {
23+ Route::group ($ config , function (): void {
24+ // Repository CRUD/actions/getters/etc. via the {repository}
25+ // wildcard. Intentionally omit ->once() so profile, search and
26+ // restifyjs/setup are not registered.
27+ app (RoutesDefinition::class)();
28+ });
29+
30+ return $ this ;
31+ }
32+ }
Original file line number Diff line number Diff line change 77 'auth ' => [
88 'table ' => 'users ' ,
99 'provider ' => 'sanctum ' ,
10- 'frontend_app_url ' => env ('FRONTEND_APP_URL ' , env ('APP_URL ' )),
11- 'password_reset_url ' => env ('FRONTEND_APP_URL ' ) . '/password/reset?token={token}&email={email} ' ,
12- 'user_verify_url ' => env ('FRONTEND_APP_URL ' ) . '/verify/{id}/{emailHash} ' ,
1310 'user_model ' => \App \Models \User::class,
1411 'token_ttl ' => env ('RESTIFY_TOKEN_TTL ' , null ),
1512 ],
You can’t perform that action at this time.
0 commit comments