我正在为我的项目使用laravel,我有两个子域,两者都指向同一个应用程序,app.project.com,user.project.com
当用户登录app.project.com时,我想将他路由到user.project.com,但问题是会话未被转移,因此用户是路由器到user.project.com但面临登录页面再次
任何解决方案?
答案 0 :(得分:0)
找到解决方案
在config / session.php中确保找到了这个
public class DiscountedTransaction : ILookup<TransactionLineDto, TransactionLineDto>
{
private readonly TransactionDto _transaction;
private readonly IEnumerable<DiscountDto> _allDiscounts;
public DiscountedTransaction(TransactionDto transaction, IEnumerable<DiscountDto> allDiscounts)
{
_transaction = transaction;
_allDiscounts = allDiscounts;
}
public IEnumerable<TransactionLineDto> this[TransactionLineDto key] => _transaction.TransactionLines
.Reverse<TransactionLineDto>()
.SkipWhile(l => l != key)
.Skip(1)
.TakeWhile(l => !IsDiscount(l));
public int Count => _transaction.TransactionLines
.Where(IsDiscount)
.Count();
public bool Contains(TransactionLineDto key) => _transaction.TransactionLines
.Where(IsDiscount)
.Contains(key);
public IEnumerator<IGrouping<TransactionLineDto, TransactionLineDto>> GetEnumerator() => ???;
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
private bool IsDiscount(TransactionLineDto line)
{
return _allDiscounts.Any(d => d.ID == line.Article);
}
}
和.env
'domain' => env('SESSION_DOMAIN', null),