Skip to content

Commit ff0bc8f

Browse files
committed
wip
1 parent d40b1e2 commit ff0bc8f

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

resources.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,30 @@ php artisan root:resource CustomPostResource --model=Post
2020

2121
## Registering Resources
2222

23-
You may register your resources by using the `RootServiceProvider` which is published and automatically registered when the `root:install` artisan command is called.
23+
Root automatically registers the resources found in the `app/Root/Resources` directory. However you may store resources somewhere else or also you may want to register a resource manually:
2424

2525
```php
2626
namespace App\Providers;
2727

28-
use App\Root\Resources\PostResource;
29-
use App\Root\Resources\UserResource;
30-
use Cone\Root\RootApplicationServiceProvider;
28+
use Cone\Root\Root;
29+
use Illuminate\Support\ServiceProvider;
3130

32-
class RootServiceProvider extends RootApplicationServiceProvider
31+
class AppServiceProvider extends ServiceProvider
3332
{
3433
/**
35-
* The resources.
34+
* Bootstrap any application services.
3635
*/
37-
protected function resources(): array
36+
public function boot(): void
3837
{
39-
return [
40-
new UserResource,
41-
new PostResource,
42-
];
38+
// Discover in custom directory
39+
Root::instance()->resources->discoverIn([
40+
app_path('Path/To/Resources'),
41+
]);
42+
43+
// Register manually
44+
Root::instance()->resources->register([
45+
new \App\Root\Resources\ProductResource,
46+
]);
4347
}
4448
}
4549
```

0 commit comments

Comments
 (0)