steelants/laravel-tenant
最新稳定版本:2.2.5
Composer 安装命令:
composer require steelants/laravel-tenant
包简介
Everything you need to start your Laravel journey.
README 文档
README
Currently WIP
Created by: SteelAnts s.r.o.
Install
php artisan vendor:publish --tag=tenant-migrations
php artisan migrate
If your tenants have thier own SMTP settings, add following into mailers array in config/mail.php
'smtp_tenant' => [
'transport' => 'smtp',
'host' => '',
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => '',
'password' => '',
'timeout' => null,
'auth_mode' => null,
],
Usage
// Access tenant manager tenantManager() // Access current tenant object tenant() // is helper wrapper function for app(TenantManager::class)->getTenant();
Sending emails
// sending emial from tenants own SMTP server tenantManager()->mailer()->to(...)->send(...); // for sending emails from app's SMTP server use Laravel's default Mail class Mail::to(...)->send(...);
Running in console
By default, on web, tenant is set in TenantServiceProvider by subdomain. To use tenant() or tenantManager()->mailer() in console,
for example in jobs, cron, ... you need to manualy set current tenant.
// Find your tenant $tenant = Tenant::find($tenantId); // Set as current tenant tenantManager()->set($tenant);
Development
Creation of symlinks for dev environment:
ln -s ./package/boilerplate/stubs/resources/ resources
Contributors
Other Packages
Notes
统计信息
- 总下载量: 866
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-11-15