2016-02-17 04:32:20 +01:00
|
|
|
<?php namespace App\Http\Controllers;
|
2016-05-01 22:55:13 +02:00
|
|
|
|
2016-02-17 04:32:20 +01:00
|
|
|
use App\Models\Expense;
|
2016-05-16 04:30:24 +02:00
|
|
|
use App\Ninja\Repositories\ExpenseRepository;
|
2016-02-17 04:32:20 +01:00
|
|
|
use App\Services\ExpenseService;
|
|
|
|
|
|
|
|
class ExpenseApiController extends BaseAPIController
|
|
|
|
{
|
|
|
|
// Expenses
|
|
|
|
protected $expenseRepo;
|
|
|
|
protected $expenseService;
|
|
|
|
|
2016-05-01 22:55:13 +02:00
|
|
|
protected $entityType = ENTITY_EXPENSE;
|
|
|
|
|
2016-02-17 04:32:20 +01:00
|
|
|
public function __construct(ExpenseRepository $expenseRepo, ExpenseService $expenseService)
|
|
|
|
{
|
2016-03-02 15:36:46 +01:00
|
|
|
parent::__construct();
|
2016-02-17 04:32:20 +01:00
|
|
|
|
|
|
|
$this->expenseRepo = $expenseRepo;
|
|
|
|
$this->expenseService = $expenseService;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function index()
|
|
|
|
{
|
|
|
|
$expenses = Expense::scope()
|
|
|
|
->withTrashed()
|
2016-05-04 13:53:27 +02:00
|
|
|
->with('client', 'invoice', 'vendor')
|
2016-02-17 04:32:20 +01:00
|
|
|
->orderBy('created_at','desc');
|
|
|
|
|
2016-05-02 10:38:01 +02:00
|
|
|
return $this->listResponse($expenses);
|
2016-02-17 04:32:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function update()
|
|
|
|
{
|
|
|
|
//stub
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public function store()
|
|
|
|
{
|
|
|
|
//stub
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public function destroy()
|
|
|
|
{
|
|
|
|
//stub
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|