Level 51
You could easily do that inside your LessonPolicy -
public function seeInvoiceWithFailedChargingAction(User $user, Lesson $lesson)
{
if ( lesson has invoice, and invoice was attempted to be charged but failed) {
return true;
}
return false;
}
Then you can use @can('seeInvoiceWithFailedChargingAction', $lesson)
Hope that helps and guide you in the right direction.
1 like