Extend incoming for better usage.

This commit is contained in:
2025-02-07 14:21:59 +01:00
parent 643e68e9a7
commit aaefe7dc51
6 changed files with 147 additions and 16 deletions

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Models\Supplier;
use Illuminate\Http\JsonResponse;
class SupplierController extends Controller
{
public function index(): JsonResponse
{
$suppliers = Supplier::orderBy('name')->get();
return response()->json($suppliers);
}
}

View File

@@ -22,6 +22,19 @@ class Incomingtax extends Model
'currency',
];
/**
* The attributes that are appended with attribute getters.
*
* @var string[]
*/
protected $appends = [
'gross',
];
public function getGrossAttribute() {
return number_format($this->taxable_amount + $this->amount, 2);
}
/**
* Get the incoming invoice this tax belongs to.
*/