@php
if(Gate::any(['user', 'adviser'])){
$prevPlan = $user->plans()->where('plan_id', '<', $plan->id)->orderByDesc('id')->first();
$nextPlan = $user->plans()->where('plan_id', '>', $plan->id)->first();
} else{
$prevPlan = Plan::where('id', '<', $plan->id)->orderByDesc('id')->first();
$nextPlan = Plan::where('id', '>', $plan->id)->first();
}
@endphp
@if($prevPlan)
@php
if(Gate::allows('adviser')){
$prevRoute = route('plans.adviser.show', ['plan' => $prevPlan->id, 'user_id' => $user->id]);
}else{
$prevRoute = route('plans.show', $prevPlan->id);
}
@endphp
{{ $prevPlan->is_special == 0 ? 'هفته' : '' }} {{ $prevPlan->week }}
@endif
{{ $plan->is_special == 0 ? 'هفته ' . $plan->week : $plan->desc }}
@if($nextPlan)
@php
if(Gate::allows('adviser')){
$nextRoute = route('plans.adviser.show', ['plan' => $nextPlan->id, 'user_id' => $user->id]);
}else{
$nextRoute = route('plans.show', $nextPlan->id);
}
@endphp
{{ $nextPlan->is_special == 0 ? 'هفته' : '' }} {{ $nextPlan->week }}
@endif