我的会员功能有问题。
升级会员资格后,他们将无法访问以前的会员资格功能。
如何解决此问题?
我有这样的控制器代码(这只是我的示例,正在运行,但无法获得以前的会员资格):
public function cashLinks()
{
$user = Auth::user();
$settings = Settings::first();
$ad_limit = $user->membership->ad_limit;
$membership = $user->membership->id;
$ad = Advert::whereUser_id($user->id)->where('date','=',date('Y-m-d'))->count();
if ($ad == 0)
{
$ptcse = Ptc::whereMembership_id($membership)->take($ad_limit)->whereStatus(1)->count();
if ($ptcse == 0){
session()->flash('message', 'You Don't have any ads);
return redirect()->route('userMemberships');
} else {
$ptcs = Ptc::whereMembership_id($membership)->take($ad_limit)->whereStatus(1)->get();
foreach ($ptcs as $ptc)
{
$info =([
'user_id'=> $user->id,
'date'=> date('Y-m-d'),
'ptc_id'=> $ptc->id,
]);
Advert::create($info);
}
$adverts = Advert::whereUser_id($user->id)->where('date','=',date('Y-m-d'))->paginate(10);
return view('user.viewads.index',compact('adverts','settings'));
}
}else{
$adverts = Advert::whereUser_id($user->id)->where('date','=',date('Y-m-d'))->paginate(10);
return view('user.viewads.index',compact('adverts','settings'));
}
}