Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 8 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| CommissionController | |
0.00% |
0 / 8 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
| index | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
2 | |||
| approve | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Http\Controllers\Admin; |
| 4 | |
| 5 | use App\Http\Controllers\Concerns\ResolvesContext; |
| 6 | use App\Http\Controllers\Controller; |
| 7 | use App\Models\Commission; |
| 8 | use App\Services\CommissionCalculatorService; |
| 9 | use Illuminate\Http\RedirectResponse; |
| 10 | use Illuminate\View\View; |
| 11 | |
| 12 | class CommissionController extends Controller |
| 13 | { |
| 14 | use ResolvesContext; |
| 15 | |
| 16 | public function index(): View |
| 17 | { |
| 18 | $commissions = Commission::query() |
| 19 | ->with('influencer', 'order', 'coupon') |
| 20 | ->where('store_id', $this->currentStore()->id) |
| 21 | ->latest() |
| 22 | ->paginate(30); |
| 23 | |
| 24 | return view('admin.commissions.index', compact('commissions')); |
| 25 | } |
| 26 | |
| 27 | public function approve(CommissionCalculatorService $service): RedirectResponse |
| 28 | { |
| 29 | $count = $service->approveEligibleForecasted(); |
| 30 | return back()->with('success', "{$count} comissão(ões) aprovadas."); |
| 31 | } |
| 32 | } |