-
app/Models/PaymentMethod.php
Open in GitHubuse Illuminate\Database\Eloquent\Model; class PaymentMethod extends Model { // public function scopeWhereCompany($query, $company_id) { $query->where('company_id', $company_id); } // }
-
app/Http/Controllers/V1/Payment/PaymentMethodsController.php
Open in GitHubuse Crater\Http\Controllers\Controller; use Crater\Models\PaymentMethod; use Illuminate\Http\Request; class PaymentMethodsController extends Controller { public function index(Request $request) { $limit = $request->has('limit') ? $request->limit : 5; $paymentMethods = PaymentMethod::whereCompany($request->header('company')) ->applyFilters($request->only([ 'method_id', 'search', ])) ->latest() ->paginateData($limit); return response()->json([ 'paymentMethods' => $paymentMethods, ]); } // }