You need to think of it in terms of how you would do it based on blade (kinda)
So imagine this being a controller method, that you post to
public function createInvoice(User $user) //user is found by route model binding
{
if(! $user->canCreateInvoice()){
return redirect()->back(); //can be returned with an ERROR that you can render in vue/react
}
if(config('invoices.max_number_of_invoices') < $user->invoices->count()){
return redirect()->back(); //can be returned with an ERROR that you can render in vue/react
}
$user->invoices->create([...]);
return redirect()->back(); //can be returned with an SUCCESS message that you can render in vue/react
}