<?php namespace App\Http\Controllers; use App\Models\StipendBatch; use App\Services\StipendService; use Illuminate\Http\Request; class StipendController extends Controller {public function index(){return view('stipends.index',['batches'=>StipendBatch::withCount('items')->latest()->paginate(20)]);}public function calculate(Request $r,StipendService $s){$d=$r->validate(['period'=>'required|date_format:Y-m']);$s->calculate($d['period']);return back()->with('success','Stipends calculated.');}public function approve(StipendBatch $batch,Request $r,StipendService $s){$s->approve($batch,$r->user()->id);return back()->with('success','Stipend batch approved and locked.');}public function paid(StipendBatch $batch,StipendService $s){$s->markPaid($batch);return back()->with('success','Stipends marked paid.');}}