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
Benjamin Beganović ab8b05dd56
Client portal improvements (#3652)
* Install livewire/livewire

* Table improvements

- Cleanup of InvoiceController
- Added Livewire package
- New Livewire component (InvoicesTable)
- New WithSorting trait
- Removed rendering invoices from index.blade.php
- Removed Yaryabox/Datatables references in InvoiceController

* Refactor: Recurring invoices

* payments table & sorting improvements

* payment methods table

* quotes table

* credits table

* Add turbolinks
2020-04-23 08:49:23 +10:00

67 lines
1.9 KiB
PHP

<?php
/**
* Invoice Ninja (https://invoiceninja.com)
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Http\Controllers\ClientPortal;
use Illuminate\Http\Request;
use App\Utils\Traits\MakesHash;
use App\Utils\Traits\MakesDates;
use App\Models\RecurringInvoice;
use App\Http\Controllers\Controller;
use App\Notifications\ClientContactRequestCancellation;
use App\Http\Requests\ClientPortal\ShowRecurringInvoiceRequest;
/**
* Class InvoiceController
* @package App\Http\Controllers\ClientPortal\InvoiceController
*/
class RecurringInvoiceController extends Controller
{
use MakesHash;
use MakesDates;
/**
* Show the list of recurring invoices.
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function index()
{
return $this->render('recurring_invoices.index');
}
/**
* Display the recurring invoice.
*
* @param ShowRecurringInvoiceRequest $request
* @param RecurringInvoice $recurring_invoice
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function show(ShowRecurringInvoiceRequest $request, RecurringInvoice $recurring_invoice)
{
return $this->render('recurring_invoices.show', [
'invoice' => $recurring_invoice->load('invoices'),
]);
}
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()));
return $this->render('recurring_invoices.cancellation.index', [
'invoice' => $recurring_invoice,
]);
}
}