Skip to content

[2.3.0] tenant_route() helper #229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 28, 2019
Merged

[2.3.0] tenant_route() helper #229

merged 5 commits into from
Nov 28, 2019

Conversation

stancl
Copy link
Member

@stancl stancl commented Nov 20, 2019

tenant_route('foo'); // current hostname
tenant_route('bar', ['a' => 'b']); // current hostname
tenant_route('abc', [], 'anotherdomain.com');

@stancl stancl added this to the 2.3.0 milestone Nov 20, 2019
@codecov
Copy link

codecov bot commented Nov 20, 2019

Codecov Report

Merging #229 into 2.x will increase coverage by 0.05%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##              2.x     #229      +/-   ##
==========================================
+ Coverage      88%   88.06%   +0.05%     
  Complexity    372      372              
==========================================
  Files          58       58              
  Lines        1084     1089       +5     
==========================================
+ Hits          954      959       +5     
  Misses        130      130
Impacted Files Coverage Δ Complexity Δ
src/helpers.php 85.71% <100%> (+7.93%) 0 <0> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f34986b...1abb6d7. Read the comment docs.

@stancl stancl merged commit fd00be6 into 2.x Nov 28, 2019
@stancl stancl deleted the tenant_route_helper branch November 28, 2019 23:12
@ahmedsayedabdelsalam
Copy link

I read the docs. if i need to store subdomain i need to store foo in domain column in domains table right? not the full domains structure.

but when i use tenant_route('foo', 'dashboard') it returns https://foo/dashboard not https://foo.example.test/dashboard

@dylanBcp
Copy link

+1 Same problem as @ahmedsayedabdelsalam

@dylanBcp
Copy link

If you want to redirect to other subdomain use :

    $domain = 'foo';
    $domain = Domain::domainFromSubdomain($domain);
    tenant_route($domain, 'dashboard')

@stancl
Copy link
Member Author

stancl commented Jul 23, 2024

tenant_route() expects hostname. It can't build a URL by combining the tenant's domain (subdomain) with a central domain, as there may be an unlimited number of central domains.

In setups that have more strictly defined how central domains work, e.g. by limiting them to one domain like our boilerplate, you can use things like domainFromSubdomain() (which itself is a boilerplate abstraction, not a Tenancy abstraction) yeah.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants