mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2026-03-03 03:17:01 +00:00
Updates for invoicing a project
This commit is contained in:
@@ -607,7 +607,7 @@ class ProjectController extends BaseController
|
||||
$this->entity_transformer = InvoiceTransformer::class;
|
||||
$this->entity_type = Invoice::class;
|
||||
|
||||
$invoice = $this->project_repo->invoice($project);
|
||||
$invoice = $this->project_repo->invoice(collect([$project]));
|
||||
|
||||
return $this->itemResponse($invoice);
|
||||
}
|
||||
|
||||
@@ -21,13 +21,23 @@ use App\Models\Project;
|
||||
* Class for project repository.
|
||||
*/
|
||||
class ProjectRepository extends BaseRepository
|
||||
{
|
||||
{
|
||||
/**
|
||||
* Invoices a collection of projects into a single invoice.
|
||||
*
|
||||
* @param mixed $projects
|
||||
* @return App\Models\Invoice
|
||||
*/
|
||||
public function invoice(mixed $projects)
|
||||
{
|
||||
$_project = $projects->first();
|
||||
|
||||
$invoice = InvoiceFactory::create($_project->company_id, $_project->user_id);
|
||||
$invoice->client_id = $_project->client_id;
|
||||
|
||||
if(count($projects) == 1) {
|
||||
$invoice->project_id = $_project->id;
|
||||
}
|
||||
// $invoice->project_id = $project->id;
|
||||
|
||||
$lines = [];
|
||||
|
||||
Reference in New Issue
Block a user