1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 07:02:34 +01:00
invoiceninja/app/Http/Controllers/ClientPortal/RecurringInvoiceController.php

65 lines
1.9 KiB
PHP
Raw Normal View History

2019-08-15 06:31:03 +02:00
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
2019-08-15 06:31:03 +02:00
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
2019-08-15 06:31:03 +02:00
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Http\Controllers\ClientPortal;
use App\Http\Controllers\Controller;
use App\Http\Requests\ClientPortal\ShowRecurringInvoiceRequest;
use App\Models\RecurringInvoice;
use App\Notifications\ClientContactRequestCancellation;
use App\Utils\Traits\MakesDates;
use App\Utils\Traits\MakesHash;
use Illuminate\Http\Request;
2019-08-15 06:31:03 +02:00
/**
* Class InvoiceController.
2019-08-15 06:31:03 +02:00
*/
class RecurringInvoiceController extends Controller
{
use MakesHash;
use MakesDates;
2020-03-23 18:10:42 +01:00
2019-08-15 06:31:03 +02:00
/**
2020-03-23 18:10:42 +01:00
* Show the list of recurring invoices.
2019-08-15 06:31:03 +02:00
*
2020-03-23 18:10:42 +01:00
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
2019-08-15 06:31:03 +02:00
*/
public function index()
2019-08-15 07:19:00 +02:00
{
return $this->render('recurring_invoices.index');
2019-08-15 06:31:03 +02:00
}
/**
2020-03-23 18:10:42 +01:00
* Display the recurring invoice.
2019-08-15 06:31:03 +02:00
*
2020-03-23 18:10:42 +01:00
* @param ShowRecurringInvoiceRequest $request
* @param RecurringInvoice $recurring_invoice
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
2019-08-15 06:31:03 +02:00
*/
public function show(ShowRecurringInvoiceRequest $request, RecurringInvoice $recurring_invoice)
2019-08-15 06:31:03 +02:00
{
2020-03-23 18:10:42 +01:00
return $this->render('recurring_invoices.show', [
'invoice' => $recurring_invoice->load('invoices'),
2020-03-23 18:10:42 +01:00
]);
2019-08-15 06:31:03 +02:00
}
public function requestCancellation(Request $request, RecurringInvoice $recurring_invoice)
{
//todo double check the user is able to request a cancellation
//can add locale specific by chaining ->locale();
$recurring_invoice->user->notify(new ClientContactRequestCancellation($recurring_invoice, auth()->user()));
2020-03-23 18:10:42 +01:00
return $this->render('recurring_invoices.cancellation.index', [
'invoice' => $recurring_invoice,
]);
}
2019-08-15 06:31:03 +02:00
}