tenancy-docs/source/docs/v3/manual-initialization.md
Tom Croft df4a487663
Use of artisan tinker for manual initialization (#219)
Small change but it took a bit for me to figure this one out so I wanted to mention it
2022-10-11 19:39:14 +02:00

17 lines
602 B
Markdown

---
title: Manual tenancy initialization
extends: _layouts.documentation
section: content
---
# Manual initialization {#manual-initialization}
Sometimes you may want to initialize tenancy manually — that is, not using web middleware, command traits, queue tenancy etc. A common use case for this is if you need to use `artisan tinker` for a specific tenant.
For that, use the `initialize()` method on `Stancl\Tenancy\Tenancy`. You can resolve the `Tenancy` instance out of the container using the `tenancy()` helper.
```php
$tenant = Tenant::find('some-id');
tenancy()->initialize($tenant);
```