Abrar Ahmad

Results 47 comments of Abrar Ahmad

@stancl As you suggested, incorporating this change in the already existing helper method `tenant_route` which will be breaking change plus method signature issues. Anyway, I came up with the implementation,...

> Also, an alternative solution to this entire tenant_path_route() thing could be figuring out if there's any way to specify a default value for the routes. I think there should...

> Would URL::default() set this for all routes with {tenant} or only routes where we apply some middleware? It's possible both ways. Don't think an app can have a route...

> Then how would the middleware work? We can just simply apply on the route group. ``` Route::group([ 'prefix' => '/app/{tenant}', 'middleware' => [InitializeTenancyByPath::class, SetDefaultTenantForUrls::class], ], function () { ```

Middleware will be like this ``` class SetDefaultTenantForUrls { public function handle($request, Closure $next) { URL::defaults(['tenant' => tenant()->id]); return $next($request); } } ```

> If it's applied to all routes, then I don't see the point of the middleware? We could just add it to the existing logic. I don't think this will...

> Why? It will be **applied** to all routes, the only difference is that it's **executed** on a route with the middleware. > > And when that's the case, I...

@stancl from your review on comments https://github.com/archtechx/tenancy/pull/915#discussion_r941930758 and https://github.com/archtechx/tenancy/pull/915#discussion_r941930690, I realized that we need this method only when creating Central model and we need sync in tenant model (only when...

@stancl I've marked reviews as resolved because new changes change all of the code.