mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Code Refactoring
- Removed unused uses - Type hinting for method parameters - Removed commented code - Introduced comments for classes and methods - Short array syntax
This commit is contained in:
parent
5f433f2ed9
commit
eb049d8ee6
@ -1,22 +1,47 @@
|
|||||||
<?php namespace App\Console\Commands;
|
<?php namespace App\Console\Commands;
|
||||||
|
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
|
||||||
use App\Ninja\Mailers\ContactMailer as Mailer;
|
use App\Ninja\Mailers\ContactMailer as Mailer;
|
||||||
use App\Ninja\Repositories\AccountRepository;
|
use App\Ninja\Repositories\AccountRepository;
|
||||||
use App\Services\PaymentService;
|
use App\Services\PaymentService;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ChargeRenewalInvoices
|
||||||
|
*/
|
||||||
class ChargeRenewalInvoices extends Command
|
class ChargeRenewalInvoices extends Command
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $name = 'ninja:charge-renewals';
|
protected $name = 'ninja:charge-renewals';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $description = 'Charge renewal invoices';
|
protected $description = 'Charge renewal invoices';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Mailer
|
||||||
|
*/
|
||||||
protected $mailer;
|
protected $mailer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var AccountRepository
|
||||||
|
*/
|
||||||
protected $accountRepo;
|
protected $accountRepo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var PaymentService
|
||||||
|
*/
|
||||||
protected $paymentService;
|
protected $paymentService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ChargeRenewalInvoices constructor.
|
||||||
|
* @param Mailer $mailer
|
||||||
|
* @param AccountRepository $repo
|
||||||
|
* @param PaymentService $paymentService
|
||||||
|
*/
|
||||||
public function __construct(Mailer $mailer, AccountRepository $repo, PaymentService $paymentService)
|
public function __construct(Mailer $mailer, AccountRepository $repo, PaymentService $paymentService)
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@ -47,17 +72,19 @@ class ChargeRenewalInvoices extends Command
|
|||||||
$this->info('Done');
|
$this->info('Done');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
protected function getArguments()
|
protected function getArguments()
|
||||||
{
|
{
|
||||||
return array(
|
return [];
|
||||||
//array('example', InputArgument::REQUIRED, 'An example argument.'),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
protected function getOptions()
|
protected function getOptions()
|
||||||
{
|
{
|
||||||
return array(
|
return [];
|
||||||
//array('example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
<?php namespace App\Console\Commands;
|
<?php namespace App\Console\Commands;
|
||||||
|
|
||||||
use DB;
|
use DB;
|
||||||
use DateTime;
|
|
||||||
use Carbon;
|
use Carbon;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@ -38,9 +36,19 @@ Options:
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class CheckData
|
||||||
|
*/
|
||||||
class CheckData extends Command {
|
class CheckData extends Command {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $name = 'ninja:check-data';
|
protected $name = 'ninja:check-data';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $description = 'Check/fix data';
|
protected $description = 'Check/fix data';
|
||||||
|
|
||||||
public function fire()
|
public function fire()
|
||||||
@ -101,7 +109,7 @@ class CheckData extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$records = $records->where("{$table}.account_id", '!=', DB::raw("{$entityType}s.account_id"))
|
$records = $records->where("{$table}.account_id", '!=', DB::raw("{$entityType}s.account_id"))
|
||||||
->get(["{$table}.id", "clients.account_id", "clients.user_id"]);
|
->get(["{$table}.id", 'clients.account_id', 'clients.user_id']);
|
||||||
|
|
||||||
if (count($records)) {
|
if (count($records)) {
|
||||||
$this->info(count($records) . " {$table} records with incorrect {$entityType} account id");
|
$this->info(count($records) . " {$table} records with incorrect {$entityType} account id");
|
||||||
@ -327,19 +335,23 @@ class CheckData extends Command {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
protected function getArguments()
|
protected function getArguments()
|
||||||
{
|
{
|
||||||
return array(
|
return [];
|
||||||
//array('example', InputArgument::REQUIRED, 'An example argument.'),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
protected function getOptions()
|
protected function getOptions()
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
array('fix', null, InputOption::VALUE_OPTIONAL, 'Fix data', null),
|
['fix', null, InputOption::VALUE_OPTIONAL, 'Fix data', null],
|
||||||
array('client_id', null, InputOption::VALUE_OPTIONAL, 'Client id', null),
|
['client_id', null, InputOption::VALUE_OPTIONAL, 'Client id', null],
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,28 +1,43 @@
|
|||||||
<?php namespace App\Console\Commands;
|
<?php namespace App\Console\Commands;
|
||||||
|
|
||||||
use stdClass;
|
|
||||||
use Auth;
|
use Auth;
|
||||||
use DB;
|
|
||||||
use Utils;
|
use Utils;
|
||||||
use Artisan;
|
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Faker\Factory;
|
use Faker\Factory;
|
||||||
use App\Models\User;
|
|
||||||
|
|
||||||
use App\Ninja\Repositories\ClientRepository;
|
use App\Ninja\Repositories\ClientRepository;
|
||||||
use App\Ninja\Repositories\InvoiceRepository;
|
use App\Ninja\Repositories\InvoiceRepository;
|
||||||
use App\Ninja\Repositories\PaymentRepository;
|
use App\Ninja\Repositories\PaymentRepository;
|
||||||
use App\Ninja\Repositories\VendorRepository;
|
use App\Ninja\Repositories\VendorRepository;
|
||||||
use App\Ninja\Repositories\ExpenseRepository;
|
use App\Ninja\Repositories\ExpenseRepository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class CreateTestData
|
||||||
|
*/
|
||||||
class CreateTestData extends Command
|
class CreateTestData extends Command
|
||||||
{
|
{
|
||||||
//protected $name = 'ninja:create-test-data';
|
//protected $name = 'ninja:create-test-data';
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $description = 'Create Test Data';
|
protected $description = 'Create Test Data';
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $signature = 'ninja:create-test-data {count=1}';
|
protected $signature = 'ninja:create-test-data {count=1}';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var
|
||||||
|
*/
|
||||||
protected $token;
|
protected $token;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CreateTestData constructor.
|
||||||
|
* @param ClientRepository $clientRepo
|
||||||
|
* @param InvoiceRepository $invoiceRepo
|
||||||
|
* @param PaymentRepository $paymentRepo
|
||||||
|
* @param VendorRepository $vendorRepo
|
||||||
|
* @param ExpenseRepository $expenseRepo
|
||||||
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
ClientRepository $clientRepo,
|
ClientRepository $clientRepo,
|
||||||
InvoiceRepository $invoiceRepo,
|
InvoiceRepository $invoiceRepo,
|
||||||
@ -41,6 +56,9 @@ class CreateTestData extends Command
|
|||||||
$this->expenseRepo = $expenseRepo;
|
$this->expenseRepo = $expenseRepo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
public function fire()
|
public function fire()
|
||||||
{
|
{
|
||||||
if (Utils::isNinjaProd()) {
|
if (Utils::isNinjaProd()) {
|
||||||
@ -83,6 +101,9 @@ class CreateTestData extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $client
|
||||||
|
*/
|
||||||
private function createInvoices($client)
|
private function createInvoices($client)
|
||||||
{
|
{
|
||||||
for ($i=0; $i<$this->count; $i++) {
|
for ($i=0; $i<$this->count; $i++) {
|
||||||
@ -102,7 +123,11 @@ class CreateTestData extends Command
|
|||||||
$this->createPayment($client, $invoice);
|
$this->createPayment($client, $invoice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $client
|
||||||
|
* @param $invoice
|
||||||
|
*/
|
||||||
private function createPayment($client, $invoice)
|
private function createPayment($client, $invoice)
|
||||||
{
|
{
|
||||||
$data = [
|
$data = [
|
||||||
@ -115,7 +140,7 @@ class CreateTestData extends Command
|
|||||||
|
|
||||||
$this->info('Payment: ' . $payment->amount);
|
$this->info('Payment: ' . $payment->amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createVendors()
|
private function createVendors()
|
||||||
{
|
{
|
||||||
for ($i=0; $i<$this->count; $i++) {
|
for ($i=0; $i<$this->count; $i++) {
|
||||||
@ -140,7 +165,10 @@ class CreateTestData extends Command
|
|||||||
$this->createExpense($vendor);
|
$this->createExpense($vendor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $vendor
|
||||||
|
*/
|
||||||
private function createExpense($vendor)
|
private function createExpense($vendor)
|
||||||
{
|
{
|
||||||
for ($i=0; $i<$this->count; $i++) {
|
for ($i=0; $i<$this->count; $i++) {
|
||||||
@ -156,17 +184,19 @@ class CreateTestData extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
protected function getArguments()
|
protected function getArguments()
|
||||||
{
|
{
|
||||||
return array(
|
return [];
|
||||||
//array('example', InputArgument::REQUIRED, 'An example argument.'),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
protected function getOptions()
|
protected function getOptions()
|
||||||
{
|
{
|
||||||
return array(
|
return [];
|
||||||
//array('example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,15 +3,22 @@
|
|||||||
use File;
|
use File;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class GenerateResources
|
||||||
|
*/
|
||||||
class GenerateResources extends Command
|
class GenerateResources extends Command
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $name = 'ninja:generate-resources';
|
protected $name = 'ninja:generate-resources';
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $description = 'Generate Resouces';
|
protected $description = 'Generate Resouces';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new command instance.
|
* Create a new command instance.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -25,22 +32,6 @@ class GenerateResources extends Command
|
|||||||
*/
|
*/
|
||||||
public function fire()
|
public function fire()
|
||||||
{
|
{
|
||||||
$langs = [
|
|
||||||
'da',
|
|
||||||
'de',
|
|
||||||
'en',
|
|
||||||
'es',
|
|
||||||
'es_ES',
|
|
||||||
'fr',
|
|
||||||
'fr_CA',
|
|
||||||
'it',
|
|
||||||
'lt',
|
|
||||||
'nb_NO',
|
|
||||||
'nl',
|
|
||||||
'pt_BR',
|
|
||||||
'sv'
|
|
||||||
];
|
|
||||||
|
|
||||||
$texts = File::getRequire(base_path() . '/resources/lang/en/texts.php');
|
$texts = File::getRequire(base_path() . '/resources/lang/en/texts.php');
|
||||||
|
|
||||||
foreach ($texts as $key => $value) {
|
foreach ($texts as $key => $value) {
|
||||||
@ -52,17 +43,19 @@ class GenerateResources extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
protected function getArguments()
|
protected function getArguments()
|
||||||
{
|
{
|
||||||
return array(
|
return [];
|
||||||
//array('example', InputArgument::REQUIRED, 'An example argument.'),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
protected function getOptions()
|
protected function getOptions()
|
||||||
{
|
{
|
||||||
return array(
|
return [];
|
||||||
//array('example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Illuminate\Foundation\Inspiring;
|
use Illuminate\Foundation\Inspiring;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Inspire
|
||||||
|
*/
|
||||||
class Inspire extends Command {
|
class Inspire extends Command {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3,9 +3,19 @@
|
|||||||
use DB;
|
use DB;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class PruneData
|
||||||
|
*/
|
||||||
class PruneData extends Command
|
class PruneData extends Command
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $name = 'ninja:prune-data';
|
protected $name = 'ninja:prune-data';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $description = 'Delete inactive accounts';
|
protected $description = 'Delete inactive accounts';
|
||||||
|
|
||||||
public function fire()
|
public function fire()
|
||||||
@ -41,17 +51,19 @@ class PruneData extends Command
|
|||||||
$this->info('Done');
|
$this->info('Done');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
protected function getArguments()
|
protected function getArguments()
|
||||||
{
|
{
|
||||||
return array(
|
return [];
|
||||||
//array('example', InputArgument::REQUIRED, 'An example argument.'),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
protected function getOptions()
|
protected function getOptions()
|
||||||
{
|
{
|
||||||
return array(
|
return [];
|
||||||
//array('example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,16 +4,25 @@ use DateTime;
|
|||||||
use App\Models\Document;
|
use App\Models\Document;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class RemoveOrphanedDocuments
|
||||||
|
*/
|
||||||
class RemoveOrphanedDocuments extends Command
|
class RemoveOrphanedDocuments extends Command
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $name = 'ninja:remove-orphaned-documents';
|
protected $name = 'ninja:remove-orphaned-documents';
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $description = 'Removes old documents not associated with an expense or invoice';
|
protected $description = 'Removes old documents not associated with an expense or invoice';
|
||||||
|
|
||||||
public function fire()
|
public function fire()
|
||||||
{
|
{
|
||||||
$this->info(date('Y-m-d').' Running RemoveOrphanedDocuments...');
|
$this->info(date('Y-m-d').' Running RemoveOrphanedDocuments...');
|
||||||
|
|
||||||
$documents = Document::whereRaw('invoice_id IS NULL AND expense_id IS NULL AND updated_at <= ?', array(new DateTime('-1 hour')))
|
$documents = Document::whereRaw('invoice_id IS NULL AND expense_id IS NULL AND updated_at <= ?', [new DateTime('-1 hour')])
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
$this->info(count($documents).' orphaned document(s) found');
|
$this->info(count($documents).' orphaned document(s) found');
|
||||||
@ -25,17 +34,19 @@ class RemoveOrphanedDocuments extends Command
|
|||||||
$this->info('Done');
|
$this->info('Done');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
protected function getArguments()
|
protected function getArguments()
|
||||||
{
|
{
|
||||||
return array(
|
return [];
|
||||||
//array('example', InputArgument::REQUIRED, 'An example argument.'),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
protected function getOptions()
|
protected function getOptions()
|
||||||
{
|
{
|
||||||
return array(
|
return [];
|
||||||
//array('example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,24 +3,33 @@
|
|||||||
|
|
||||||
use Utils;
|
use Utils;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
|
||||||
|
|
||||||
class ResetData extends Command {
|
/**
|
||||||
|
* Class ResetData
|
||||||
|
*/
|
||||||
|
class ResetData extends Command
|
||||||
|
{
|
||||||
|
|
||||||
protected $name = 'ninja:reset-data';
|
/**
|
||||||
protected $description = 'Reset data';
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $name = 'ninja:reset-data';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = 'Reset data';
|
||||||
|
|
||||||
public function fire()
|
public function fire()
|
||||||
{
|
{
|
||||||
$this->info(date('Y-m-d') . ' Running ResetData...');
|
$this->info(date('Y-m-d') . ' Running ResetData...');
|
||||||
|
|
||||||
if (!Utils::isNinjaDev()) {
|
if (!Utils::isNinjaDev()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Artisan::call('migrate:reset');
|
||||||
|
Artisan::call('migrate');
|
||||||
|
Artisan::call('db:seed');
|
||||||
}
|
}
|
||||||
|
|
||||||
Artisan::call('migrate:reset');
|
|
||||||
Artisan::call('migrate');
|
|
||||||
Artisan::call('db:seed');
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,26 +1,48 @@
|
|||||||
<?php namespace App\Console\Commands;
|
<?php namespace App\Console\Commands;
|
||||||
|
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use Carbon;
|
|
||||||
use Utils;
|
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
|
||||||
use App\Ninja\Mailers\ContactMailer as Mailer;
|
use App\Ninja\Mailers\ContactMailer as Mailer;
|
||||||
use App\Ninja\Repositories\InvoiceRepository;
|
use App\Ninja\Repositories\InvoiceRepository;
|
||||||
use App\Services\PaymentService;
|
use App\Services\PaymentService;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Models\InvoiceItem;
|
|
||||||
use App\Models\Invitation;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class SendRecurringInvoices
|
||||||
|
*/
|
||||||
class SendRecurringInvoices extends Command
|
class SendRecurringInvoices extends Command
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $name = 'ninja:send-invoices';
|
protected $name = 'ninja:send-invoices';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $description = 'Send recurring invoices';
|
protected $description = 'Send recurring invoices';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Mailer
|
||||||
|
*/
|
||||||
protected $mailer;
|
protected $mailer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var InvoiceRepository
|
||||||
|
*/
|
||||||
protected $invoiceRepo;
|
protected $invoiceRepo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var PaymentService
|
||||||
|
*/
|
||||||
protected $paymentService;
|
protected $paymentService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SendRecurringInvoices constructor.
|
||||||
|
* @param Mailer $mailer
|
||||||
|
* @param InvoiceRepository $invoiceRepo
|
||||||
|
* @param PaymentService $paymentService
|
||||||
|
*/
|
||||||
public function __construct(Mailer $mailer, InvoiceRepository $invoiceRepo, PaymentService $paymentService)
|
public function __construct(Mailer $mailer, InvoiceRepository $invoiceRepo, PaymentService $paymentService)
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@ -36,7 +58,7 @@ class SendRecurringInvoices extends Command
|
|||||||
$today = new DateTime();
|
$today = new DateTime();
|
||||||
|
|
||||||
$invoices = Invoice::with('account.timezone', 'invoice_items', 'client', 'user')
|
$invoices = Invoice::with('account.timezone', 'invoice_items', 'client', 'user')
|
||||||
->whereRaw('is_deleted IS FALSE AND deleted_at IS NULL AND is_recurring IS TRUE AND frequency_id > 0 AND start_date <= ? AND (end_date IS NULL OR end_date >= ?)', array($today, $today))
|
->whereRaw('is_deleted IS FALSE AND deleted_at IS NULL AND is_recurring IS TRUE AND frequency_id > 0 AND start_date <= ? AND (end_date IS NULL OR end_date >= ?)', [$today, $today])
|
||||||
->orderBy('id', 'asc')
|
->orderBy('id', 'asc')
|
||||||
->get();
|
->get();
|
||||||
$this->info(count($invoices).' recurring invoice(s) found');
|
$this->info(count($invoices).' recurring invoice(s) found');
|
||||||
@ -59,11 +81,12 @@ class SendRecurringInvoices extends Command
|
|||||||
$delayedAutoBillInvoices = Invoice::with('account.timezone', 'recurring_invoice', 'invoice_items', 'client', 'user')
|
$delayedAutoBillInvoices = Invoice::with('account.timezone', 'recurring_invoice', 'invoice_items', 'client', 'user')
|
||||||
->whereRaw('is_deleted IS FALSE AND deleted_at IS NULL AND is_recurring IS FALSE
|
->whereRaw('is_deleted IS FALSE AND deleted_at IS NULL AND is_recurring IS FALSE
|
||||||
AND balance > 0 AND due_date = ? AND recurring_invoice_id IS NOT NULL',
|
AND balance > 0 AND due_date = ? AND recurring_invoice_id IS NOT NULL',
|
||||||
array($today->format('Y-m-d')))
|
[$today->format('Y-m-d')])
|
||||||
->orderBy('invoices.id', 'asc')
|
->orderBy('invoices.id', 'asc')
|
||||||
->get();
|
->get();
|
||||||
$this->info(count($delayedAutoBillInvoices).' due recurring invoice instance(s) found');
|
$this->info(count($delayedAutoBillInvoices).' due recurring invoice instance(s) found');
|
||||||
|
|
||||||
|
/** @var Invoice $invoice */
|
||||||
foreach ($delayedAutoBillInvoices as $invoice) {
|
foreach ($delayedAutoBillInvoices as $invoice) {
|
||||||
if ($invoice->isPaid()) {
|
if ($invoice->isPaid()) {
|
||||||
continue;
|
continue;
|
||||||
@ -78,17 +101,19 @@ class SendRecurringInvoices extends Command
|
|||||||
$this->info('Done');
|
$this->info('Done');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
protected function getArguments()
|
protected function getArguments()
|
||||||
{
|
{
|
||||||
return array(
|
return [];
|
||||||
//array('example', InputArgument::REQUIRED, 'An example argument.'),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
protected function getOptions()
|
protected function getOptions()
|
||||||
{
|
{
|
||||||
return array(
|
return [];
|
||||||
//array('example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,47 @@
|
|||||||
<?php namespace App\Console\Commands;
|
<?php namespace App\Console\Commands;
|
||||||
|
|
||||||
use DB;
|
use App\Models\Invoice;
|
||||||
use DateTime;
|
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
|
||||||
use App\Models\Account;
|
|
||||||
use App\Ninja\Mailers\ContactMailer as Mailer;
|
use App\Ninja\Mailers\ContactMailer as Mailer;
|
||||||
use App\Ninja\Repositories\accountRepository;
|
use App\Ninja\Repositories\AccountRepository;
|
||||||
use App\Ninja\Repositories\InvoiceRepository;
|
use App\Ninja\Repositories\InvoiceRepository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class SendReminders
|
||||||
|
*/
|
||||||
class SendReminders extends Command
|
class SendReminders extends Command
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $name = 'ninja:send-reminders';
|
protected $name = 'ninja:send-reminders';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $description = 'Send reminder emails';
|
protected $description = 'Send reminder emails';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Mailer
|
||||||
|
*/
|
||||||
protected $mailer;
|
protected $mailer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var InvoiceRepository
|
||||||
|
*/
|
||||||
protected $invoiceRepo;
|
protected $invoiceRepo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var accountRepository
|
||||||
|
*/
|
||||||
protected $accountRepo;
|
protected $accountRepo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SendReminders constructor.
|
||||||
|
* @param Mailer $mailer
|
||||||
|
* @param InvoiceRepository $invoiceRepo
|
||||||
|
* @param accountRepository $accountRepo
|
||||||
|
*/
|
||||||
public function __construct(Mailer $mailer, InvoiceRepository $invoiceRepo, AccountRepository $accountRepo)
|
public function __construct(Mailer $mailer, InvoiceRepository $invoiceRepo, AccountRepository $accountRepo)
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@ -29,20 +53,21 @@ class SendReminders extends Command
|
|||||||
|
|
||||||
public function fire()
|
public function fire()
|
||||||
{
|
{
|
||||||
$this->info(date('Y-m-d').' Running SendReminders...');
|
$this->info(date('Y-m-d') . ' Running SendReminders...');
|
||||||
$today = new DateTime();
|
|
||||||
|
|
||||||
$accounts = $this->accountRepo->findWithReminders();
|
$accounts = $this->accountRepo->findWithReminders();
|
||||||
$this->info(count($accounts).' accounts found');
|
$this->info(count($accounts) . ' accounts found');
|
||||||
|
|
||||||
|
/** @var \App\Models\Account $account */
|
||||||
foreach ($accounts as $account) {
|
foreach ($accounts as $account) {
|
||||||
if (!$account->hasFeature(FEATURE_EMAIL_TEMPLATES_REMINDERS)) {
|
if (!$account->hasFeature(FEATURE_EMAIL_TEMPLATES_REMINDERS)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$invoices = $this->invoiceRepo->findNeedingReminding($account);
|
$invoices = $this->invoiceRepo->findNeedingReminding($account);
|
||||||
$this->info($account->name . ': ' . count($invoices).' invoices found');
|
$this->info($account->name . ': ' . count($invoices) . ' invoices found');
|
||||||
|
|
||||||
|
/** @var Invoice $invoice */
|
||||||
foreach ($invoices as $invoice) {
|
foreach ($invoices as $invoice) {
|
||||||
if ($reminder = $account->getInvoiceReminder($invoice)) {
|
if ($reminder = $account->getInvoiceReminder($invoice)) {
|
||||||
$this->info('Send to ' . $invoice->id);
|
$this->info('Send to ' . $invoice->id);
|
||||||
@ -54,17 +79,19 @@ class SendReminders extends Command
|
|||||||
$this->info('Done');
|
$this->info('Done');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
protected function getArguments()
|
protected function getArguments()
|
||||||
{
|
{
|
||||||
return array(
|
return [];
|
||||||
//array('example', InputArgument::REQUIRED, 'An example argument.'),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
protected function getOptions()
|
protected function getOptions()
|
||||||
{
|
{
|
||||||
return array(
|
return [];
|
||||||
//array('example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,41 @@
|
|||||||
<?php namespace App\Console\Commands;
|
<?php namespace App\Console\Commands;
|
||||||
|
|
||||||
use DB;
|
|
||||||
use DateTime;
|
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Ninja\Mailers\ContactMailer as Mailer;
|
use App\Ninja\Mailers\ContactMailer as Mailer;
|
||||||
use App\Ninja\Repositories\AccountRepository;
|
use App\Ninja\Repositories\AccountRepository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class SendRenewalInvoices
|
||||||
|
*/
|
||||||
class SendRenewalInvoices extends Command
|
class SendRenewalInvoices extends Command
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $name = 'ninja:send-renewals';
|
protected $name = 'ninja:send-renewals';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $description = 'Send renewal invoices';
|
protected $description = 'Send renewal invoices';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Mailer
|
||||||
|
*/
|
||||||
protected $mailer;
|
protected $mailer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var AccountRepository
|
||||||
|
*/
|
||||||
protected $accountRepo;
|
protected $accountRepo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SendRenewalInvoices constructor.
|
||||||
|
*
|
||||||
|
* @param Mailer $mailer
|
||||||
|
* @param AccountRepository $repo
|
||||||
|
*/
|
||||||
public function __construct(Mailer $mailer, AccountRepository $repo)
|
public function __construct(Mailer $mailer, AccountRepository $repo)
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@ -23,12 +43,10 @@ class SendRenewalInvoices extends Command
|
|||||||
$this->mailer = $mailer;
|
$this->mailer = $mailer;
|
||||||
$this->accountRepo = $repo;
|
$this->accountRepo = $repo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function fire()
|
public function fire()
|
||||||
{
|
{
|
||||||
$this->info(date('Y-m-d').' Running SendRenewalInvoices...');
|
$this->info(date('Y-m-d').' Running SendRenewalInvoices...');
|
||||||
$today = new DateTime();
|
|
||||||
$sentTo = [];
|
|
||||||
|
|
||||||
// get all accounts with plans expiring in 10 days
|
// get all accounts with plans expiring in 10 days
|
||||||
$companies = Company::whereRaw('datediff(plan_expires, curdate()) = 10')
|
$companies = Company::whereRaw('datediff(plan_expires, curdate()) = 10')
|
||||||
@ -73,17 +91,19 @@ class SendRenewalInvoices extends Command
|
|||||||
$this->info('Done');
|
$this->info('Done');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
protected function getArguments()
|
protected function getArguments()
|
||||||
{
|
{
|
||||||
return array(
|
return [];
|
||||||
//array('example', InputArgument::REQUIRED, 'An example argument.'),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
protected function getOptions()
|
protected function getOptions()
|
||||||
{
|
{
|
||||||
return array(
|
return [];
|
||||||
//array('example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,11 +3,31 @@
|
|||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use App\Services\BankAccountService;
|
use App\Services\BankAccountService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class TestOFX
|
||||||
|
*/
|
||||||
class TestOFX extends Command
|
class TestOFX extends Command
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $name = 'ninja:test-ofx';
|
protected $name = 'ninja:test-ofx';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $description = 'Test OFX';
|
protected $description = 'Test OFX';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var BankAccountService
|
||||||
|
*/
|
||||||
|
protected $bankAccountService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TestOFX constructor.
|
||||||
|
*
|
||||||
|
* @param BankAccountService $bankAccountService
|
||||||
|
*/
|
||||||
public function __construct(BankAccountService $bankAccountService)
|
public function __construct(BankAccountService $bankAccountService)
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@ -18,15 +38,5 @@ class TestOFX extends Command
|
|||||||
public function fire()
|
public function fire()
|
||||||
{
|
{
|
||||||
$this->info(date('Y-m-d').' Running TestOFX...');
|
$this->info(date('Y-m-d').' Running TestOFX...');
|
||||||
|
|
||||||
/*
|
|
||||||
$bankId = env('TEST_BANK_ID');
|
|
||||||
$username = env('TEST_BANK_USERNAME');
|
|
||||||
$password = env('TEST_BANK_PASSWORD');
|
|
||||||
|
|
||||||
$data = $this->bankAccountService->loadBankAccounts($bankId, $username, $password, false);
|
|
||||||
|
|
||||||
echo json_encode($data);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,20 +1,26 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
use App\Models\Client;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ClientWasArchived
|
||||||
|
*/
|
||||||
class ClientWasArchived extends Event
|
class ClientWasArchived extends Event
|
||||||
{
|
{
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Client
|
||||||
|
*/
|
||||||
public $client;
|
public $client;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Client $client
|
||||||
*/
|
*/
|
||||||
public function __construct($client)
|
public function __construct(Client $client)
|
||||||
{
|
{
|
||||||
$this->client = $client;
|
$this->client = $client;
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,26 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
use App\Models\Client;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ClientWasCreated
|
||||||
|
*/
|
||||||
class ClientWasCreated extends Event
|
class ClientWasCreated extends Event
|
||||||
{
|
{
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Client
|
||||||
|
*/
|
||||||
public $client;
|
public $client;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Client $client
|
||||||
*/
|
*/
|
||||||
public function __construct($client)
|
public function __construct(Client $client)
|
||||||
{
|
{
|
||||||
$this->client = $client;
|
$this->client = $client;
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,26 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
use App\Models\Client;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ClientWasDeleted
|
||||||
|
*/
|
||||||
class ClientWasDeleted extends Event
|
class ClientWasDeleted extends Event
|
||||||
{
|
{
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Client
|
||||||
|
*/
|
||||||
public $client;
|
public $client;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Client $client
|
||||||
*/
|
*/
|
||||||
public function __construct($client)
|
public function __construct(Client $client)
|
||||||
{
|
{
|
||||||
$this->client = $client;
|
$this->client = $client;
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,26 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
use App\Models\Client;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ClientWasRestored
|
||||||
|
*/
|
||||||
class ClientWasRestored extends Event
|
class ClientWasRestored extends Event
|
||||||
{
|
{
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Client
|
||||||
|
*/
|
||||||
public $client;
|
public $client;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Client $client
|
||||||
*/
|
*/
|
||||||
public function __construct($client)
|
public function __construct(Client $client)
|
||||||
{
|
{
|
||||||
$this->client = $client;
|
$this->client = $client;
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,26 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
use App\Models\Client;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ClientWasUpdated
|
||||||
|
*/
|
||||||
class ClientWasUpdated extends Event
|
class ClientWasUpdated extends Event
|
||||||
{
|
{
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Client
|
||||||
|
*/
|
||||||
public $client;
|
public $client;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Client $client
|
||||||
*/
|
*/
|
||||||
public function __construct($client)
|
public function __construct(Client $client)
|
||||||
{
|
{
|
||||||
$this->client = $client;
|
$this->client = $client;
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,30 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
|
||||||
|
|
||||||
|
use App\Models\Client;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class CreditWasArchived extends Event {
|
/**
|
||||||
|
* Class CreditWasArchived
|
||||||
|
*/
|
||||||
|
class CreditWasArchived extends Event
|
||||||
|
{
|
||||||
|
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Client
|
||||||
|
*/
|
||||||
public $credit;
|
public $credit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Client $credit
|
||||||
*/
|
*/
|
||||||
public function __construct($credit)
|
public function __construct(Client $credit)
|
||||||
{
|
{
|
||||||
$this->credit = $credit;
|
$this->credit = $credit;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,24 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
use App\Models\Credit;
|
||||||
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class CreditWasCreated extends Event {
|
class CreditWasCreated extends Event
|
||||||
|
{
|
||||||
|
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Credit
|
||||||
|
*/
|
||||||
public $credit;
|
public $credit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Credit $credit
|
||||||
*/
|
*/
|
||||||
public function __construct($credit)
|
public function __construct(Credit $credit)
|
||||||
{
|
{
|
||||||
$this->credit = $credit;
|
$this->credit = $credit;
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,26 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
use App\Models\Credit;
|
||||||
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class CreditWasDeleted
|
||||||
|
*/
|
||||||
class CreditWasDeleted extends Event {
|
class CreditWasDeleted extends Event {
|
||||||
|
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Credit
|
||||||
|
*/
|
||||||
public $credit;
|
public $credit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Credit $credit
|
||||||
*/
|
*/
|
||||||
public function __construct($credit)
|
public function __construct(Credit $credit)
|
||||||
{
|
{
|
||||||
$this->credit = $credit;
|
$this->credit = $credit;
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,27 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
|
||||||
|
|
||||||
|
use App\Models\Credit;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class CreditWasRestored
|
||||||
|
*/
|
||||||
class CreditWasRestored extends Event {
|
class CreditWasRestored extends Event {
|
||||||
|
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Credit
|
||||||
|
*/
|
||||||
public $credit;
|
public $credit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Credit $credit
|
||||||
*/
|
*/
|
||||||
public function __construct($credit)
|
public function __construct(Credit $credit)
|
||||||
{
|
{
|
||||||
$this->credit = $credit;
|
$this->credit = $credit;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
abstract class Event {
|
abstract class Event
|
||||||
|
{
|
||||||
//
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,28 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
use App\Models\Expense;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ExpenseWasArchived
|
||||||
|
*/
|
||||||
class ExpenseWasArchived extends Event
|
class ExpenseWasArchived extends Event
|
||||||
{
|
{
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Expense
|
||||||
|
*/
|
||||||
public $expense;
|
public $expense;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Expense $expense
|
||||||
*/
|
*/
|
||||||
public function __construct($expense)
|
public function __construct(Expense $expense)
|
||||||
{
|
{
|
||||||
$this->expense = $expense;
|
$this->expense = $expense;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,26 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
use App\Models\Expense;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ExpenseWasCreated
|
||||||
|
*/
|
||||||
class ExpenseWasCreated extends Event
|
class ExpenseWasCreated extends Event
|
||||||
{
|
{
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Expense
|
||||||
|
*/
|
||||||
public $expense;
|
public $expense;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Expense $expense
|
||||||
*/
|
*/
|
||||||
public function __construct($expense)
|
public function __construct(Expense $expense)
|
||||||
{
|
{
|
||||||
$this->expense = $expense;
|
$this->expense = $expense;
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,26 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
use App\Models\Expense;
|
||||||
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class ExpenseWasDeleted extends Event {
|
/**
|
||||||
// Expenses
|
* Class ExpenseWasDeleted
|
||||||
use SerializesModels;
|
*/
|
||||||
|
class ExpenseWasDeleted extends Event
|
||||||
|
{
|
||||||
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Expense
|
||||||
|
*/
|
||||||
public $expense;
|
public $expense;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Expense $expense
|
||||||
*/
|
*/
|
||||||
public function __construct($expense)
|
public function __construct(Expense $expense)
|
||||||
{
|
{
|
||||||
$this->expense = $expense;
|
$this->expense = $expense;
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,27 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
|
||||||
|
|
||||||
|
use App\Models\Expense;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class ExpenseWasRestored extends Event {
|
/**
|
||||||
// Expenses
|
* Class ExpenseWasRestored
|
||||||
use SerializesModels;
|
*/
|
||||||
|
class ExpenseWasRestored extends Event
|
||||||
|
{
|
||||||
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Expense
|
||||||
|
*/
|
||||||
public $expense;
|
public $expense;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Expense $expense
|
||||||
*/
|
*/
|
||||||
public function __construct($expense)
|
public function __construct(Expense $expense)
|
||||||
{
|
{
|
||||||
$this->expense = $expense;
|
$this->expense = $expense;
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,26 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
use App\Models\Expense;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ExpenseWasUpdated
|
||||||
|
*/
|
||||||
class ExpenseWasUpdated extends Event
|
class ExpenseWasUpdated extends Event
|
||||||
{
|
{
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Expense
|
||||||
|
*/
|
||||||
public $expense;
|
public $expense;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Expense $expense
|
||||||
*/
|
*/
|
||||||
public function __construct($expense)
|
public function __construct(Expense $expense)
|
||||||
{
|
{
|
||||||
$this->expense = $expense;
|
$this->expense = $expense;
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,28 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
|
||||||
|
|
||||||
|
use App\Models\Invitation;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class InvoiceInvitationWasEmailed extends Event {
|
/**
|
||||||
|
* Class InvoiceInvitationWasEmailed
|
||||||
|
*/
|
||||||
|
class InvoiceInvitationWasEmailed extends Event
|
||||||
|
{
|
||||||
|
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Invitation
|
||||||
|
*/
|
||||||
public $invitation;
|
public $invitation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Invitation $invitation
|
||||||
*/
|
*/
|
||||||
public function __construct($invitation)
|
public function __construct(Invitation $invitation)
|
||||||
{
|
{
|
||||||
$this->invitation = $invitation;
|
$this->invitation = $invitation;
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,35 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
use App\Models\Invitation;
|
||||||
|
use App\Models\Invoice;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class InvoiceInvitationWasViewed
|
||||||
|
*/
|
||||||
class InvoiceInvitationWasViewed extends Event {
|
class InvoiceInvitationWasViewed extends Event {
|
||||||
|
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Invoice
|
||||||
|
*/
|
||||||
public $invoice;
|
public $invoice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Invitation
|
||||||
|
*/
|
||||||
public $invitation;
|
public $invitation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Invoice $invoice
|
||||||
*/
|
* @param Invitation $invitation
|
||||||
public function __construct($invoice, $invitation)
|
*/
|
||||||
|
public function __construct(Invoice $invoice, Invitation $invitation)
|
||||||
{
|
{
|
||||||
$this->invoice = $invoice;
|
$this->invoice = $invoice;
|
||||||
$this->invitation = $invitation;
|
$this->invitation = $invitation;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,26 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
use App\Models\Invoice;
|
||||||
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class InvoiceWasArchived extends Event {
|
/**
|
||||||
|
* Class InvoiceWasArchived
|
||||||
|
*/
|
||||||
|
class InvoiceWasArchived extends Event
|
||||||
|
{
|
||||||
|
use SerializesModels;
|
||||||
|
|
||||||
use SerializesModels;
|
/**
|
||||||
|
* @var Invoice
|
||||||
|
*/
|
||||||
public $invoice;
|
public $invoice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Invoice $invoice
|
||||||
*/
|
*/
|
||||||
public function __construct($invoice)
|
public function __construct(Invoice $invoice)
|
||||||
{
|
{
|
||||||
$this->invoice = $invoice;
|
$this->invoice = $invoice;
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,26 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
use App\Models\Invoice;
|
||||||
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class InvoiceWasCreated extends Event {
|
/**
|
||||||
|
* Class InvoiceWasCreated
|
||||||
|
*/
|
||||||
|
class InvoiceWasCreated extends Event
|
||||||
|
{
|
||||||
|
use SerializesModels;
|
||||||
|
|
||||||
use SerializesModels;
|
/**
|
||||||
|
* @var Invoice
|
||||||
|
*/
|
||||||
public $invoice;
|
public $invoice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Invoice $invoice
|
||||||
*/
|
*/
|
||||||
public function __construct($invoice)
|
public function __construct(Invoice $invoice)
|
||||||
{
|
{
|
||||||
$this->invoice = $invoice;
|
$this->invoice = $invoice;
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,27 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
use App\Models\Invoice;
|
||||||
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class InvoiceWasDeleted extends Event {
|
/**
|
||||||
|
* Class InvoiceWasDeleted
|
||||||
|
*/
|
||||||
|
class InvoiceWasDeleted extends Event
|
||||||
|
{
|
||||||
|
use SerializesModels;
|
||||||
|
|
||||||
use SerializesModels;
|
/**
|
||||||
|
* @var Invoice
|
||||||
|
*/
|
||||||
public $invoice;
|
public $invoice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Invoice $invoice
|
||||||
*/
|
*/
|
||||||
public function __construct($invoice)
|
public function __construct(Invoice $invoice)
|
||||||
{
|
{
|
||||||
$this->invoice = $invoice;
|
$this->invoice = $invoice;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,27 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
use App\Models\Invoice;
|
||||||
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class InvoiceWasEmailed extends Event {
|
/**
|
||||||
|
* Class InvoiceWasEmailed
|
||||||
|
*/
|
||||||
|
class InvoiceWasEmailed extends Event
|
||||||
|
{
|
||||||
|
use SerializesModels;
|
||||||
|
|
||||||
use SerializesModels;
|
/**
|
||||||
|
* @var Invoice
|
||||||
|
*/
|
||||||
public $invoice;
|
public $invoice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Invoice $invoice
|
||||||
*/
|
*/
|
||||||
public function __construct($invoice)
|
public function __construct(Invoice $invoice)
|
||||||
{
|
{
|
||||||
$this->invoice = $invoice;
|
$this->invoice = $invoice;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,30 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
|
||||||
|
|
||||||
|
use App\Models\Invoice;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class InvoiceWasRestored extends Event {
|
/**
|
||||||
|
* Class InvoiceWasRestored
|
||||||
use SerializesModels;
|
*/
|
||||||
|
class InvoiceWasRestored extends Event
|
||||||
|
{
|
||||||
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Invoice
|
||||||
|
*/
|
||||||
public $invoice;
|
public $invoice;
|
||||||
|
|
||||||
public $fromDeleted;
|
public $fromDeleted;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Invoice $invoice
|
||||||
*/
|
* @param $fromDeleted
|
||||||
public function __construct($invoice, $fromDeleted)
|
*/
|
||||||
|
public function __construct(Invoice $invoice, $fromDeleted)
|
||||||
{
|
{
|
||||||
$this->invoice = $invoice;
|
$this->invoice = $invoice;
|
||||||
$this->fromDeleted = $fromDeleted;
|
$this->fromDeleted = $fromDeleted;
|
||||||
|
@ -1,22 +1,27 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
use App\Models\Invoice;
|
||||||
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class InvoiceWasUpdated extends Event {
|
/**
|
||||||
|
* Class InvoiceWasUpdated
|
||||||
|
*/
|
||||||
|
class InvoiceWasUpdated extends Event
|
||||||
|
{
|
||||||
|
use SerializesModels;
|
||||||
|
|
||||||
use SerializesModels;
|
/**
|
||||||
|
* @var Invoice
|
||||||
|
*/
|
||||||
public $invoice;
|
public $invoice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Invoice $invoice
|
||||||
*/
|
*/
|
||||||
public function __construct($invoice)
|
public function __construct(Invoice $invoice)
|
||||||
{
|
{
|
||||||
$this->invoice = $invoice;
|
$this->invoice = $invoice;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,26 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
use App\Models\Payment;
|
||||||
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class PaymentCompleted extends Event {
|
/**
|
||||||
|
* Class PaymentCompleted
|
||||||
|
*/
|
||||||
|
class PaymentCompleted extends Event
|
||||||
|
{
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Payment
|
||||||
|
*/
|
||||||
public $payment;
|
public $payment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Payment $payment
|
||||||
*/
|
*/
|
||||||
public function __construct($payment)
|
public function __construct(Payment $payment)
|
||||||
{
|
{
|
||||||
$this->payment = $payment;
|
$this->payment = $payment;
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,27 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
use App\Models\Payment;
|
||||||
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class PaymentFailed extends Event {
|
/**
|
||||||
|
* Class PaymentFailed
|
||||||
|
*/
|
||||||
|
class PaymentFailed extends Event
|
||||||
|
{
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Payment
|
||||||
|
*/
|
||||||
public $payment;
|
public $payment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Payment $payment
|
||||||
*/
|
*/
|
||||||
public function __construct($payment)
|
public function __construct(Payment $payment)
|
||||||
{
|
{
|
||||||
$this->payment = $payment;
|
$this->payment = $payment;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,28 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
use App\Models\Payment;
|
||||||
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class PaymentWasArchived extends Event {
|
/**
|
||||||
|
* Class PaymentWasArchived
|
||||||
|
*/
|
||||||
|
class PaymentWasArchived extends Event
|
||||||
|
{
|
||||||
|
use SerializesModels;
|
||||||
|
|
||||||
use SerializesModels;
|
/**
|
||||||
|
* @var Payment
|
||||||
|
*/
|
||||||
public $payment;
|
public $payment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Payment $payment
|
||||||
*/
|
*/
|
||||||
public function __construct($payment)
|
public function __construct(Payment $payment)
|
||||||
{
|
{
|
||||||
$this->payment = $payment;
|
$this->payment = $payment;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,27 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
use App\Models\Payment;
|
||||||
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class PaymentWasCreated extends Event {
|
/**
|
||||||
|
* Class PaymentWasCreated
|
||||||
|
*/
|
||||||
|
class PaymentWasCreated extends Event
|
||||||
|
{
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Payment
|
||||||
|
*/
|
||||||
public $payment;
|
public $payment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Payment $payment
|
||||||
*/
|
*/
|
||||||
public function __construct($payment)
|
public function __construct(Payment $payment)
|
||||||
{
|
{
|
||||||
$this->payment = $payment;
|
$this->payment = $payment;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,29 @@
|
|||||||
<?php namespace App\Events;
|
<?php
|
||||||
|
|
||||||
use App\Events\Event;
|
namespace App\Events;
|
||||||
|
|
||||||
|
use App\Models\Payment;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class PaymentWasDeleted extends Event {
|
/**
|
||||||
|
* Class PaymentWasDeleted.
|
||||||
|
*/
|
||||||
|
class PaymentWasDeleted extends Event
|
||||||
|
{
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Payment
|
||||||
|
*/
|
||||||
public $payment;
|
public $payment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Payment $payment
|
||||||
*/
|
*/
|
||||||
public function __construct($payment)
|
public function __construct(Payment $payment)
|
||||||
{
|
{
|
||||||
$this->payment = $payment;
|
$this->payment = $payment;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,31 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
use App\Models\Payment;
|
||||||
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class PaymentWasRefunded extends Event {
|
/**
|
||||||
|
* Class PaymentWasRefunded
|
||||||
use SerializesModels;
|
*/
|
||||||
|
class PaymentWasRefunded extends Event
|
||||||
|
{
|
||||||
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Payment
|
||||||
|
*/
|
||||||
public $payment;
|
public $payment;
|
||||||
|
|
||||||
public $refundAmount;
|
public $refundAmount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Payment $payment
|
||||||
*/
|
* @param $refundAmount
|
||||||
public function __construct($payment, $refundAmount)
|
*/
|
||||||
|
public function __construct(Payment $payment, $refundAmount)
|
||||||
{
|
{
|
||||||
$this->payment = $payment;
|
$this->payment = $payment;
|
||||||
$this->refundAmount = $refundAmount;
|
$this->refundAmount = $refundAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,30 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
use App\Models\Payment;
|
||||||
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class PaymentWasRestored extends Event {
|
/**
|
||||||
|
* Class PaymentWasRestored
|
||||||
use SerializesModels;
|
*/
|
||||||
|
class PaymentWasRestored extends Event
|
||||||
|
{
|
||||||
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Payment
|
||||||
|
*/
|
||||||
public $payment;
|
public $payment;
|
||||||
public $fromDeleted;
|
public $fromDeleted;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Payment $payment
|
||||||
*/
|
* @param $fromDeleted
|
||||||
public function __construct($payment, $fromDeleted)
|
*/
|
||||||
|
public function __construct(Payment $payment, $fromDeleted)
|
||||||
{
|
{
|
||||||
$this->payment = $payment;
|
$this->payment = $payment;
|
||||||
$this->fromDeleted = $fromDeleted;
|
$this->fromDeleted = $fromDeleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,27 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
use App\Models\Payment;
|
||||||
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class PaymentWasVoided extends Event {
|
/**
|
||||||
|
* Class PaymentWasVoided
|
||||||
|
*/
|
||||||
|
class PaymentWasVoided extends Event
|
||||||
|
{
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Payment
|
||||||
|
*/
|
||||||
public $payment;
|
public $payment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Payment $payment
|
||||||
*/
|
*/
|
||||||
public function __construct($payment)
|
public function __construct(Payment $payment)
|
||||||
{
|
{
|
||||||
$this->payment = $payment;
|
$this->payment = $payment;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,27 +1,37 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
|
||||||
|
|
||||||
|
use App\Models\Invitation;
|
||||||
|
use App\Models\Invoice;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class QuoteInvitationWasApproved extends Event {
|
class QuoteInvitationWasApproved extends Event
|
||||||
|
{
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
public $quote;
|
public $quote;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Invoice
|
||||||
|
*/
|
||||||
public $invoice;
|
public $invoice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Invitation
|
||||||
|
*/
|
||||||
public $invitation;
|
public $invitation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param $quote
|
||||||
*/
|
* @param Invoice $invoice
|
||||||
public function __construct($quote, $invoice, $invitation)
|
* @param Invitation $invitation
|
||||||
|
*/
|
||||||
|
public function __construct($quote, Invoice $invoice, Invitation $invitation)
|
||||||
{
|
{
|
||||||
$this->quote = $quote;
|
$this->quote = $quote;
|
||||||
$this->invoice = $invoice;
|
$this->invoice = $invoice;
|
||||||
$this->invitation = $invitation;
|
$this->invitation = $invitation;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,26 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
use App\Models\Invitation;
|
||||||
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class QuoteInvitationWasEmailed extends Event {
|
/**
|
||||||
|
* Class QuoteInvitationWasEmailed
|
||||||
use SerializesModels;
|
*/
|
||||||
|
class QuoteInvitationWasEmailed extends Event
|
||||||
|
{
|
||||||
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Invitation
|
||||||
|
*/
|
||||||
public $invitation;
|
public $invitation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Invitation $invitation
|
||||||
*/
|
*/
|
||||||
public function __construct($invitation)
|
public function __construct(Invitation $invitation)
|
||||||
{
|
{
|
||||||
$this->invitation = $invitation;
|
$this->invitation = $invitation;
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,31 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
use App\Models\Invitation;
|
||||||
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class QuoteInvitationWasViewed extends Event {
|
/**
|
||||||
|
* Class QuoteInvitationWasViewed
|
||||||
|
*/
|
||||||
|
class QuoteInvitationWasViewed extends Event
|
||||||
|
{
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
public $quote;
|
public $quote;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Invitation
|
||||||
|
*/
|
||||||
public $invitation;
|
public $invitation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param $quote
|
||||||
*/
|
* @param Invitation $invitation
|
||||||
public function __construct($quote, $invitation)
|
*/
|
||||||
|
public function __construct($quote, Invitation $invitation)
|
||||||
{
|
{
|
||||||
$this->quote = $quote;
|
$this->quote = $quote;
|
||||||
$this->invitation = $invitation;
|
$this->invitation = $invitation;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,20 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
|
||||||
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class QuoteWasArchived extends Event {
|
class QuoteWasArchived extends Event
|
||||||
|
{
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
public $quote;
|
public $quote;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param $quote
|
||||||
*/
|
*/
|
||||||
public function __construct($quote)
|
public function __construct($quote)
|
||||||
{
|
{
|
||||||
$this->quote = $quote;
|
$this->quote = $quote;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
|
||||||
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class QuoteWasCreated extends Event {
|
/**
|
||||||
|
* Class QuoteWasCreated
|
||||||
use SerializesModels;
|
*/
|
||||||
|
class QuoteWasCreated extends Event
|
||||||
|
{
|
||||||
|
use SerializesModels;
|
||||||
public $quote;
|
public $quote;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param $quote
|
||||||
*/
|
*/
|
||||||
public function __construct($quote)
|
public function __construct($quote)
|
||||||
{
|
{
|
||||||
$this->quote = $quote;
|
$this->quote = $quote;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
|
||||||
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class QuoteWasDeleted extends Event {
|
/**
|
||||||
|
* Class QuoteWasDeleted
|
||||||
use SerializesModels;
|
*/
|
||||||
|
class QuoteWasDeleted extends Event
|
||||||
|
{
|
||||||
|
use SerializesModels;
|
||||||
public $quote;
|
public $quote;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param $quote
|
||||||
*/
|
*/
|
||||||
public function __construct($quote)
|
public function __construct($quote)
|
||||||
{
|
{
|
||||||
$this->quote = $quote;
|
$this->quote = $quote;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
|
||||||
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class QuoteWasEmailed extends Event {
|
/**
|
||||||
|
* Class QuoteWasEmailed
|
||||||
use SerializesModels;
|
*/
|
||||||
|
class QuoteWasEmailed extends Event
|
||||||
|
{
|
||||||
|
use SerializesModels;
|
||||||
public $quote;
|
public $quote;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param $quote
|
||||||
*/
|
*/
|
||||||
public function __construct($quote)
|
public function __construct($quote)
|
||||||
{
|
{
|
||||||
$this->quote = $quote;
|
$this->quote = $quote;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
|
||||||
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class QuoteWasRestored extends Event {
|
/**
|
||||||
|
* Class QuoteWasRestored
|
||||||
use SerializesModels;
|
*/
|
||||||
|
class QuoteWasRestored extends Event
|
||||||
|
{
|
||||||
|
use SerializesModels;
|
||||||
public $quote;
|
public $quote;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param $quote
|
||||||
*/
|
*/
|
||||||
public function __construct($quote)
|
public function __construct($quote)
|
||||||
{
|
{
|
||||||
$this->quote = $quote;
|
$this->quote = $quote;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,23 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
|
||||||
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class QuoteWasUpdated extends Event {
|
/**
|
||||||
|
* Class QuoteWasUpdated
|
||||||
use SerializesModels;
|
*/
|
||||||
|
class QuoteWasUpdated extends Event
|
||||||
|
{
|
||||||
|
use SerializesModels;
|
||||||
public $quote;
|
public $quote;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param $quote
|
||||||
*/
|
*/
|
||||||
public function __construct($quote)
|
public function __construct($quote)
|
||||||
{
|
{
|
||||||
$this->quote = $quote;
|
$this->quote = $quote;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,18 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
|
||||||
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class UserLoggedIn extends Event {
|
/**
|
||||||
|
* Class UserLoggedIn
|
||||||
use SerializesModels;
|
*/
|
||||||
|
class UserLoggedIn extends Event
|
||||||
/**
|
{
|
||||||
* Create a new event instance.
|
use SerializesModels;
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UserLoggedIn constructor.
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,24 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
use App\Models\User;
|
||||||
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class UserSettingsChanged extends Event {
|
class UserSettingsChanged extends Event
|
||||||
|
{
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var User
|
||||||
|
*/
|
||||||
public $user;
|
public $user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param User $user
|
||||||
*/
|
*/
|
||||||
public function __construct($user = false)
|
public function __construct(User $user = false)
|
||||||
{
|
{
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,18 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
|
||||||
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class UserSignedUp extends Event {
|
/**
|
||||||
|
* Class UserSignedUp
|
||||||
use SerializesModels;
|
*/
|
||||||
|
class UserSignedUp extends Event
|
||||||
/**
|
{
|
||||||
* Create a new event instance.
|
use SerializesModels;
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new event instance.
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,27 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
use App\Models\Vendor;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class VendorWasArchived
|
||||||
|
*/
|
||||||
class VendorWasArchived extends Event
|
class VendorWasArchived extends Event
|
||||||
{
|
{
|
||||||
// vendor
|
// vendor
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Vendor
|
||||||
|
*/
|
||||||
public $vendor;
|
public $vendor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Vendor $vendor
|
||||||
*/
|
*/
|
||||||
public function __construct($vendor)
|
public function __construct(Vendor $vendor)
|
||||||
{
|
{
|
||||||
$this->vendor = $vendor;
|
$this->vendor = $vendor;
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,26 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
use App\Models\Vendor;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class VendorWasCreated
|
||||||
|
*/
|
||||||
class VendorWasCreated extends Event
|
class VendorWasCreated extends Event
|
||||||
{
|
{
|
||||||
// vendor
|
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Vendor
|
||||||
|
*/
|
||||||
public $vendor;
|
public $vendor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Vendor $vendor
|
||||||
*/
|
*/
|
||||||
public function __construct($vendor)
|
public function __construct(Vendor $vendor)
|
||||||
{
|
{
|
||||||
$this->vendor = $vendor;
|
$this->vendor = $vendor;
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,26 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
use App\Models\Vendor;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class VendorWasDeleted
|
||||||
|
*/
|
||||||
class VendorWasDeleted extends Event
|
class VendorWasDeleted extends Event
|
||||||
{
|
{
|
||||||
// vendor
|
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Vendor
|
||||||
|
*/
|
||||||
public $vendor;
|
public $vendor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Vendor $vendor
|
||||||
*/
|
*/
|
||||||
public function __construct($vendor)
|
public function __construct(Vendor $vendor)
|
||||||
{
|
{
|
||||||
$this->vendor = $vendor;
|
$this->vendor = $vendor;
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,26 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
|
|
||||||
use App\Events\Event;
|
use App\Models\Vendor;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class VendorWasRestored
|
||||||
|
*/
|
||||||
class VendorWasRestored extends Event
|
class VendorWasRestored extends Event
|
||||||
{
|
{
|
||||||
// vendor
|
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Vendor
|
||||||
|
*/
|
||||||
public $vendor;
|
public $vendor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Vendor $vendor
|
||||||
*/
|
*/
|
||||||
public function __construct($vendor)
|
public function __construct(Vendor $vendor)
|
||||||
{
|
{
|
||||||
$this->vendor = $vendor;
|
$this->vendor = $vendor;
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,26 @@
|
|||||||
<?php namespace App\Events;
|
<?php namespace App\Events;
|
||||||
// vendor
|
|
||||||
use App\Events\Event;
|
use App\Models\Vendor;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class VendorWasUpdated
|
||||||
|
*/
|
||||||
class VendorWasUpdated extends Event
|
class VendorWasUpdated extends Event
|
||||||
{
|
{
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Vendor
|
||||||
|
*/
|
||||||
public $vendor;
|
public $vendor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @param Vendor $vendor
|
||||||
*/
|
*/
|
||||||
public function __construct($vendor)
|
public function __construct(Vendor $vendor)
|
||||||
{
|
{
|
||||||
$this->vendor = $vendor;
|
$this->vendor = $vendor;
|
||||||
}
|
}
|
||||||
|
@ -4,13 +4,17 @@ use Redirect;
|
|||||||
use Utils;
|
use Utils;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||||
use Illuminate\Http\Exception\HttpResponseException;
|
use Illuminate\Http\Exception\HttpResponseException;
|
||||||
use Illuminate\Auth\Access\AuthorizationException;
|
use Illuminate\Auth\Access\AuthorizationException;
|
||||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||||
use Illuminate\Foundation\Validation\ValidationException;
|
use Illuminate\Validation\ValidationException;
|
||||||
|
|
||||||
class Handler extends ExceptionHandler {
|
/**
|
||||||
|
* Class Handler
|
||||||
|
*/
|
||||||
|
class Handler extends ExceptionHandler
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of the exception types that should not be reported.
|
* A list of the exception types that should not be reported.
|
||||||
@ -24,14 +28,14 @@ class Handler extends ExceptionHandler {
|
|||||||
ValidationException::class,
|
ValidationException::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Report or log an exception.
|
* Report or log an exception.
|
||||||
*
|
*
|
||||||
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
|
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
|
||||||
*
|
*
|
||||||
* @param \Exception $e
|
* @param \Exception $e
|
||||||
* @return void
|
* @return bool|void
|
||||||
*/
|
*/
|
||||||
public function report(Exception $e)
|
public function report(Exception $e)
|
||||||
{
|
{
|
||||||
// don't show these errors in the logs
|
// don't show these errors in the logs
|
||||||
|
@ -3,22 +3,12 @@
|
|||||||
use Auth;
|
use Auth;
|
||||||
use Utils;
|
use Utils;
|
||||||
use Response;
|
use Response;
|
||||||
use Input;
|
|
||||||
use Validator;
|
|
||||||
use Cache;
|
use Cache;
|
||||||
use App\Models\Client;
|
|
||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
use App\Models\AccountToken;
|
|
||||||
use App\Ninja\Repositories\AccountRepository;
|
use App\Ninja\Repositories\AccountRepository;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use League\Fractal;
|
|
||||||
use League\Fractal\Manager;
|
|
||||||
use App\Ninja\Serializers\ArraySerializer;
|
|
||||||
use App\Ninja\Transformers\AccountTransformer;
|
use App\Ninja\Transformers\AccountTransformer;
|
||||||
use App\Ninja\Transformers\UserAccountTransformer;
|
use App\Ninja\Transformers\UserAccountTransformer;
|
||||||
use App\Http\Controllers\BaseAPIController;
|
|
||||||
use Swagger\Annotations as SWG;
|
|
||||||
|
|
||||||
use App\Events\UserSignedUp;
|
use App\Events\UserSignedUp;
|
||||||
use App\Http\Requests\RegisterRequest;
|
use App\Http\Requests\RegisterRequest;
|
||||||
use App\Http\Requests\UpdateAccountRequest;
|
use App\Http\Requests\UpdateAccountRequest;
|
||||||
@ -183,8 +173,6 @@ class AccountApiController extends BaseAPIController
|
|||||||
'notify_paid' => $request->notify_paid,
|
'notify_paid' => $request->notify_paid,
|
||||||
];
|
];
|
||||||
|
|
||||||
//unset($devices[$x]);
|
|
||||||
|
|
||||||
$devices[$x] = $newDevice;
|
$devices[$x] = $newDevice;
|
||||||
$account->devices = json_encode($devices);
|
$account->devices = json_encode($devices);
|
||||||
$account->save();
|
$account->save();
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<?php namespace App\Http\Controllers;
|
<?php namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Models\AccountGateway;
|
use App\Models\AccountGateway;
|
||||||
|
use App\Services\TemplateService;
|
||||||
use Auth;
|
use Auth;
|
||||||
use File;
|
use File;
|
||||||
use Image;
|
use Image;
|
||||||
@ -33,21 +34,55 @@ use App\Events\UserSignedUp;
|
|||||||
use App\Events\UserSettingsChanged;
|
use App\Events\UserSettingsChanged;
|
||||||
use App\Services\AuthService;
|
use App\Services\AuthService;
|
||||||
use App\Services\PaymentService;
|
use App\Services\PaymentService;
|
||||||
|
|
||||||
use App\Http\Requests\UpdateAccountRequest;
|
use App\Http\Requests\UpdateAccountRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class AccountController
|
||||||
|
*/
|
||||||
class AccountController extends BaseController
|
class AccountController extends BaseController
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var AccountRepository
|
||||||
|
*/
|
||||||
protected $accountRepo;
|
protected $accountRepo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var UserMailer
|
||||||
|
*/
|
||||||
protected $userMailer;
|
protected $userMailer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ContactMailer
|
||||||
|
*/
|
||||||
protected $contactMailer;
|
protected $contactMailer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ReferralRepository
|
||||||
|
*/
|
||||||
protected $referralRepository;
|
protected $referralRepository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var PaymentService
|
||||||
|
*/
|
||||||
protected $paymentService;
|
protected $paymentService;
|
||||||
|
|
||||||
public function __construct(AccountRepository $accountRepo, UserMailer $userMailer, ContactMailer $contactMailer, ReferralRepository $referralRepository, PaymentService $paymentService)
|
/**
|
||||||
|
* AccountController constructor.
|
||||||
|
*
|
||||||
|
* @param AccountRepository $accountRepo
|
||||||
|
* @param UserMailer $userMailer
|
||||||
|
* @param ContactMailer $contactMailer
|
||||||
|
* @param ReferralRepository $referralRepository
|
||||||
|
* @param PaymentService $paymentService
|
||||||
|
*/
|
||||||
|
public function __construct(
|
||||||
|
AccountRepository $accountRepo,
|
||||||
|
UserMailer $userMailer,
|
||||||
|
ContactMailer $contactMailer,
|
||||||
|
ReferralRepository $referralRepository,
|
||||||
|
PaymentService $paymentService
|
||||||
|
)
|
||||||
{
|
{
|
||||||
//parent::__construct();
|
|
||||||
|
|
||||||
$this->accountRepo = $accountRepo;
|
$this->accountRepo = $accountRepo;
|
||||||
$this->userMailer = $userMailer;
|
$this->userMailer = $userMailer;
|
||||||
$this->contactMailer = $contactMailer;
|
$this->contactMailer = $contactMailer;
|
||||||
@ -55,6 +90,9 @@ class AccountController extends BaseController
|
|||||||
$this->paymentService = $paymentService;
|
$this->paymentService = $paymentService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
public function demo()
|
public function demo()
|
||||||
{
|
{
|
||||||
$demoAccountId = Utils::getDemoAccountId();
|
$demoAccountId = Utils::getDemoAccountId();
|
||||||
@ -71,6 +109,9 @@ class AccountController extends BaseController
|
|||||||
return Redirect::to('invoices/create');
|
return Redirect::to('invoices/create');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
public function getStarted()
|
public function getStarted()
|
||||||
{
|
{
|
||||||
$user = false;
|
$user = false;
|
||||||
@ -113,6 +154,9 @@ class AccountController extends BaseController
|
|||||||
return Redirect::to($redirectTo)->with('sign_up', Input::get('sign_up'));
|
return Redirect::to($redirectTo)->with('sign_up', Input::get('sign_up'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool|mixed
|
||||||
|
*/
|
||||||
public function enableProPlan()
|
public function enableProPlan()
|
||||||
{
|
{
|
||||||
if (Auth::user()->isPro() && ! Auth::user()->isTrial()) {
|
if (Auth::user()->isPro() && ! Auth::user()->isTrial()) {
|
||||||
@ -124,6 +168,9 @@ class AccountController extends BaseController
|
|||||||
return $invitation->invitation_key;
|
return $invitation->invitation_key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
public function changePlan() {
|
public function changePlan() {
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
$account = $user->account;
|
$account = $user->account;
|
||||||
@ -143,22 +190,22 @@ class AccountController extends BaseController
|
|||||||
$term = PLAN_TERM_YEARLY;
|
$term = PLAN_TERM_YEARLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
$new_plan = array(
|
$new_plan = [
|
||||||
'plan' => PLAN_ENTERPRISE,
|
'plan' => PLAN_ENTERPRISE,
|
||||||
'term' => $term,
|
'term' => $term,
|
||||||
);
|
];
|
||||||
} elseif ($planDetails['plan'] == $plan) {
|
} elseif ($planDetails['plan'] == $plan) {
|
||||||
// Term switch
|
// Term switch
|
||||||
if ($planDetails['term'] == PLAN_TERM_YEARLY && $term == PLAN_TERM_MONTHLY) {
|
if ($planDetails['term'] == PLAN_TERM_YEARLY && $term == PLAN_TERM_MONTHLY) {
|
||||||
$pending_change = array(
|
$pending_change = [
|
||||||
'plan' => $plan,
|
'plan' => $plan,
|
||||||
'term' => $term
|
'term' => $term
|
||||||
);
|
];
|
||||||
} elseif ($planDetails['term'] == PLAN_TERM_MONTHLY && $term == PLAN_TERM_YEARLY) {
|
} elseif ($planDetails['term'] == PLAN_TERM_MONTHLY && $term == PLAN_TERM_YEARLY) {
|
||||||
$new_plan = array(
|
$new_plan = [
|
||||||
'plan' => $plan,
|
'plan' => $plan,
|
||||||
'term' => $term,
|
'term' => $term,
|
||||||
);
|
];
|
||||||
} else {
|
} else {
|
||||||
// Cancel the pending change
|
// Cancel the pending change
|
||||||
$account->company->pending_plan = null;
|
$account->company->pending_plan = null;
|
||||||
@ -194,10 +241,10 @@ class AccountController extends BaseController
|
|||||||
$account->company->save();
|
$account->company->save();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$pending_change = array(
|
$pending_change = [
|
||||||
'plan' => $plan,
|
'plan' => $plan,
|
||||||
'term' => $plan == PLAN_FREE ? null : $term,
|
'term' => $plan == PLAN_FREE ? null : $term,
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,10 +264,10 @@ class AccountController extends BaseController
|
|||||||
$credit = $old_plan_price * (1 - $percent_used);
|
$credit = $old_plan_price * (1 - $percent_used);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$new_plan = array(
|
$new_plan = [
|
||||||
'plan' => $plan,
|
'plan' => $plan,
|
||||||
'term' => $term,
|
'term' => $term,
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($pending_change) && empty($new_plan)) {
|
if (!empty($pending_change) && empty($new_plan)) {
|
||||||
@ -239,6 +286,11 @@ class AccountController extends BaseController
|
|||||||
return Redirect::to('/settings/'.ACCOUNT_MANAGEMENT, 301);
|
return Redirect::to('/settings/'.ACCOUNT_MANAGEMENT, 301);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $entityType
|
||||||
|
* @param $visible
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
public function setTrashVisible($entityType, $visible)
|
public function setTrashVisible($entityType, $visible)
|
||||||
{
|
{
|
||||||
Session::put("show_trash:{$entityType}", $visible == 'true');
|
Session::put("show_trash:{$entityType}", $visible == 'true');
|
||||||
@ -246,6 +298,9 @@ class AccountController extends BaseController
|
|||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Http\JsonResponse
|
||||||
|
*/
|
||||||
public function getSearchData()
|
public function getSearchData()
|
||||||
{
|
{
|
||||||
$data = $this->accountRepo->getSearchData(Auth::user());
|
$data = $this->accountRepo->getSearchData(Auth::user());
|
||||||
@ -253,6 +308,10 @@ class AccountController extends BaseController
|
|||||||
return Response::json($data);
|
return Response::json($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $section
|
||||||
|
* @return \Illuminate\Contracts\View\View|\Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
public function showSection($section = false)
|
public function showSection($section = false)
|
||||||
{
|
{
|
||||||
if (!$section) {
|
if (!$section) {
|
||||||
@ -298,6 +357,9 @@ class AccountController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Contracts\View\View|\Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
private function showSystemSettings()
|
private function showSystemSettings()
|
||||||
{
|
{
|
||||||
if (Utils::isNinjaProd()) {
|
if (Utils::isNinjaProd()) {
|
||||||
@ -306,13 +368,16 @@ class AccountController extends BaseController
|
|||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'account' => Account::with('users')->findOrFail(Auth::user()->account_id),
|
'account' => Account::with('users')->findOrFail(Auth::user()->account_id),
|
||||||
'title' => trans("texts.system_settings"),
|
'title' => trans('texts.system_settings'),
|
||||||
'section' => ACCOUNT_SYSTEM_SETTINGS,
|
'section' => ACCOUNT_SYSTEM_SETTINGS,
|
||||||
];
|
];
|
||||||
|
|
||||||
return View::make("accounts.system_settings", $data);
|
return View::make('accounts.system_settings', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Contracts\View\View
|
||||||
|
*/
|
||||||
private function showInvoiceSettings()
|
private function showInvoiceSettings()
|
||||||
{
|
{
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
@ -329,14 +394,17 @@ class AccountController extends BaseController
|
|||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'account' => Account::with('users')->findOrFail(Auth::user()->account_id),
|
'account' => Account::with('users')->findOrFail(Auth::user()->account_id),
|
||||||
'title' => trans("texts.invoice_settings"),
|
'title' => trans('texts.invoice_settings'),
|
||||||
'section' => ACCOUNT_INVOICE_SETTINGS,
|
'section' => ACCOUNT_INVOICE_SETTINGS,
|
||||||
'recurringHours' => $recurringHours,
|
'recurringHours' => $recurringHours,
|
||||||
];
|
];
|
||||||
|
|
||||||
return View::make("accounts.invoice_settings", $data);
|
return View::make('accounts.invoice_settings', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Contracts\View\View
|
||||||
|
*/
|
||||||
private function showCompanyDetails()
|
private function showCompanyDetails()
|
||||||
{
|
{
|
||||||
// check that logo is less than the max file size
|
// check that logo is less than the max file size
|
||||||
@ -356,6 +424,9 @@ class AccountController extends BaseController
|
|||||||
return View::make('accounts.details', $data);
|
return View::make('accounts.details', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Contracts\View\View
|
||||||
|
*/
|
||||||
private function showAccountManagement()
|
private function showAccountManagement()
|
||||||
{
|
{
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
@ -368,6 +439,9 @@ class AccountController extends BaseController
|
|||||||
return View::make('accounts.management', $data);
|
return View::make('accounts.management', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Contracts\View\View
|
||||||
|
*/
|
||||||
public function showUserDetails()
|
public function showUserDetails()
|
||||||
{
|
{
|
||||||
$oauthLoginUrls = [];
|
$oauthLoginUrls = [];
|
||||||
@ -387,6 +461,9 @@ class AccountController extends BaseController
|
|||||||
return View::make('accounts.user_details', $data);
|
return View::make('accounts.user_details', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Contracts\View\View
|
||||||
|
*/
|
||||||
private function showLocalization()
|
private function showLocalization()
|
||||||
{
|
{
|
||||||
$data = [
|
$data = [
|
||||||
@ -402,6 +479,9 @@ class AccountController extends BaseController
|
|||||||
return View::make('accounts.localization', $data);
|
return View::make('accounts.localization', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Contracts\View\View
|
||||||
|
*/
|
||||||
private function showBankAccounts()
|
private function showBankAccounts()
|
||||||
{
|
{
|
||||||
return View::make('accounts.banks', [
|
return View::make('accounts.banks', [
|
||||||
@ -409,6 +489,9 @@ class AccountController extends BaseController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Contracts\View\View|\Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
private function showOnlinePayments()
|
private function showOnlinePayments()
|
||||||
{
|
{
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
@ -439,6 +522,9 @@ class AccountController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Contracts\View\View
|
||||||
|
*/
|
||||||
private function showProducts()
|
private function showProducts()
|
||||||
{
|
{
|
||||||
$columns = ['product', 'description', 'unit_cost'];
|
$columns = ['product', 'description', 'unit_cost'];
|
||||||
@ -456,6 +542,9 @@ class AccountController extends BaseController
|
|||||||
return View::make('accounts.products', $data);
|
return View::make('accounts.products', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Contracts\View\View
|
||||||
|
*/
|
||||||
private function showTaxRates()
|
private function showTaxRates()
|
||||||
{
|
{
|
||||||
$data = [
|
$data = [
|
||||||
@ -467,6 +556,9 @@ class AccountController extends BaseController
|
|||||||
return View::make('accounts.tax_rates', $data);
|
return View::make('accounts.tax_rates', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Contracts\View\View
|
||||||
|
*/
|
||||||
private function showPaymentTerms()
|
private function showPaymentTerms()
|
||||||
{
|
{
|
||||||
$data = [
|
$data = [
|
||||||
@ -478,6 +570,10 @@ class AccountController extends BaseController
|
|||||||
return View::make('accounts.payment_terms', $data);
|
return View::make('accounts.payment_terms', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $section
|
||||||
|
* @return \Illuminate\Contracts\View\View
|
||||||
|
*/
|
||||||
private function showInvoiceDesign($section)
|
private function showInvoiceDesign($section)
|
||||||
{
|
{
|
||||||
$account = Auth::user()->account->load('country');
|
$account = Auth::user()->account->load('country');
|
||||||
@ -608,6 +704,9 @@ class AccountController extends BaseController
|
|||||||
return View::make("accounts.{$section}", $data);
|
return View::make("accounts.{$section}", $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Contracts\View\View
|
||||||
|
*/
|
||||||
private function showClientPortal()
|
private function showClientPortal()
|
||||||
{
|
{
|
||||||
$account = Auth::user()->account->load('country');
|
$account = Auth::user()->account->load('country');
|
||||||
@ -616,8 +715,8 @@ class AccountController extends BaseController
|
|||||||
if (Utils::isNinja() && $css) {
|
if (Utils::isNinja() && $css) {
|
||||||
// Unescape the CSS for display purposes
|
// Unescape the CSS for display purposes
|
||||||
$css = str_replace(
|
$css = str_replace(
|
||||||
array('\3C ', '\3E ', '\26 '),
|
['\3C ', '\3E ', '\26 '],
|
||||||
array('<', '>', '&'),
|
['<', '>', '&'],
|
||||||
$css
|
$css
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -626,14 +725,17 @@ class AccountController extends BaseController
|
|||||||
'client_view_css' => $css,
|
'client_view_css' => $css,
|
||||||
'enable_portal_password' => $account->enable_portal_password,
|
'enable_portal_password' => $account->enable_portal_password,
|
||||||
'send_portal_password' => $account->send_portal_password,
|
'send_portal_password' => $account->send_portal_password,
|
||||||
'title' => trans("texts.client_portal"),
|
'title' => trans('texts.client_portal'),
|
||||||
'section' => ACCOUNT_CLIENT_PORTAL,
|
'section' => ACCOUNT_CLIENT_PORTAL,
|
||||||
'account' => $account,
|
'account' => $account,
|
||||||
];
|
];
|
||||||
|
|
||||||
return View::make("accounts.client_portal", $data);
|
return View::make('accounts.client_portal', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Contracts\View\View
|
||||||
|
*/
|
||||||
private function showTemplates()
|
private function showTemplates()
|
||||||
{
|
{
|
||||||
$account = Auth::user()->account->load('country');
|
$account = Auth::user()->account->load('country');
|
||||||
@ -656,6 +758,10 @@ class AccountController extends BaseController
|
|||||||
return View::make('accounts.templates_and_reminders', $data);
|
return View::make('accounts.templates_and_reminders', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $section
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
public function doSection($section = ACCOUNT_COMPANY_DETAILS)
|
public function doSection($section = ACCOUNT_COMPANY_DETAILS)
|
||||||
{
|
{
|
||||||
if ($section === ACCOUNT_COMPANY_DETAILS) {
|
if ($section === ACCOUNT_COMPANY_DETAILS) {
|
||||||
@ -689,6 +795,9 @@ class AccountController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
private function saveCustomizeDesign()
|
private function saveCustomizeDesign()
|
||||||
{
|
{
|
||||||
if (Auth::user()->account->hasFeature(FEATURE_CUSTOMIZE_INVOICE_DESIGN)) {
|
if (Auth::user()->account->hasFeature(FEATURE_CUSTOMIZE_INVOICE_DESIGN)) {
|
||||||
@ -703,6 +812,9 @@ class AccountController extends BaseController
|
|||||||
return Redirect::to('settings/'.ACCOUNT_CUSTOMIZE_DESIGN);
|
return Redirect::to('settings/'.ACCOUNT_CUSTOMIZE_DESIGN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
private function saveClientPortal()
|
private function saveClientPortal()
|
||||||
{
|
{
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
@ -756,6 +868,9 @@ class AccountController extends BaseController
|
|||||||
return Redirect::to('settings/'.ACCOUNT_CLIENT_PORTAL);
|
return Redirect::to('settings/'.ACCOUNT_CLIENT_PORTAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
private function saveEmailTemplates()
|
private function saveEmailTemplates()
|
||||||
{
|
{
|
||||||
if (Auth::user()->account->hasFeature(FEATURE_EMAIL_TEMPLATES_REMINDERS)) {
|
if (Auth::user()->account->hasFeature(FEATURE_EMAIL_TEMPLATES_REMINDERS)) {
|
||||||
@ -790,6 +905,9 @@ class AccountController extends BaseController
|
|||||||
return Redirect::to('settings/'.ACCOUNT_TEMPLATES_AND_REMINDERS);
|
return Redirect::to('settings/'.ACCOUNT_TEMPLATES_AND_REMINDERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
private function saveTaxRates()
|
private function saveTaxRates()
|
||||||
{
|
{
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
@ -801,6 +919,9 @@ class AccountController extends BaseController
|
|||||||
return Redirect::to('settings/'.ACCOUNT_TAX_RATES);
|
return Redirect::to('settings/'.ACCOUNT_TAX_RATES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
private function saveProducts()
|
private function saveProducts()
|
||||||
{
|
{
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
@ -814,13 +935,16 @@ class AccountController extends BaseController
|
|||||||
return Redirect::to('settings/'.ACCOUNT_PRODUCTS);
|
return Redirect::to('settings/'.ACCOUNT_PRODUCTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return $this|\Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
private function saveEmailSettings()
|
private function saveEmailSettings()
|
||||||
{
|
{
|
||||||
if (Auth::user()->account->hasFeature(FEATURE_CUSTOM_EMAILS)) {
|
if (Auth::user()->account->hasFeature(FEATURE_CUSTOM_EMAILS)) {
|
||||||
$rules = [];
|
$rules = [];
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
$iframeURL = preg_replace('/[^a-zA-Z0-9_\-\:\/\.]/', '', substr(strtolower(Input::get('iframe_url')), 0, MAX_IFRAME_URL_LENGTH));
|
$iframeURL = preg_replace('/[^a-zA-Z0-9_\-\:\/\.]/', '', substr(strtolower(Input::get('iframe_url')), 0, MAX_IFRAME_URL_LENGTH));
|
||||||
$iframeURL = rtrim($iframeURL, "/");
|
$iframeURL = rtrim($iframeURL, '/');
|
||||||
|
|
||||||
$subdomain = preg_replace('/[^a-zA-Z0-9_\-\.]/', '', substr(strtolower(Input::get('subdomain')), 0, MAX_SUBDOMAIN_LENGTH));
|
$subdomain = preg_replace('/[^a-zA-Z0-9_\-\.]/', '', substr(strtolower(Input::get('subdomain')), 0, MAX_SUBDOMAIN_LENGTH));
|
||||||
if ($iframeURL) {
|
if ($iframeURL) {
|
||||||
@ -857,6 +981,9 @@ class AccountController extends BaseController
|
|||||||
return Redirect::to('settings/'.ACCOUNT_EMAIL_SETTINGS);
|
return Redirect::to('settings/'.ACCOUNT_EMAIL_SETTINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return $this|\Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
private function saveInvoiceSettings()
|
private function saveInvoiceSettings()
|
||||||
{
|
{
|
||||||
if (Auth::user()->account->hasFeature(FEATURE_INVOICE_SETTINGS)) {
|
if (Auth::user()->account->hasFeature(FEATURE_INVOICE_SETTINGS)) {
|
||||||
@ -938,6 +1065,9 @@ class AccountController extends BaseController
|
|||||||
return Redirect::to('settings/'.ACCOUNT_INVOICE_SETTINGS);
|
return Redirect::to('settings/'.ACCOUNT_INVOICE_SETTINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
private function saveInvoiceDesign()
|
private function saveInvoiceDesign()
|
||||||
{
|
{
|
||||||
if (Auth::user()->account->hasFeature(FEATURE_CUSTOMIZE_INVOICE_DESIGN)) {
|
if (Auth::user()->account->hasFeature(FEATURE_CUSTOMIZE_INVOICE_DESIGN)) {
|
||||||
@ -982,6 +1112,9 @@ class AccountController extends BaseController
|
|||||||
return Redirect::to('settings/'.ACCOUNT_INVOICE_DESIGN);
|
return Redirect::to('settings/'.ACCOUNT_INVOICE_DESIGN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
private function saveNotifications()
|
private function saveNotifications()
|
||||||
{
|
{
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
@ -996,6 +1129,10 @@ class AccountController extends BaseController
|
|||||||
return Redirect::to('settings/'.ACCOUNT_NOTIFICATIONS);
|
return Redirect::to('settings/'.ACCOUNT_NOTIFICATIONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param UpdateAccountRequest $request
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
public function updateDetails(UpdateAccountRequest $request)
|
public function updateDetails(UpdateAccountRequest $request)
|
||||||
{
|
{
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
@ -1018,7 +1155,7 @@ class AccountController extends BaseController
|
|||||||
$documentType = $extension;
|
$documentType = $extension;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!in_array($documentType, array('jpeg', 'png', 'gif'))){
|
if(!in_array($documentType, ['jpeg', 'png', 'gif'])){
|
||||||
Session::flash('warning', 'Unsupported file type');
|
Session::flash('warning', 'Unsupported file type');
|
||||||
} else {
|
} else {
|
||||||
$documentTypeData = Document::$types[$documentType];
|
$documentTypeData = Document::$types[$documentType];
|
||||||
@ -1082,8 +1219,12 @@ class AccountController extends BaseController
|
|||||||
return Redirect::to('settings/'.ACCOUNT_COMPANY_DETAILS);
|
return Redirect::to('settings/'.ACCOUNT_COMPANY_DETAILS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return $this|\Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
public function saveUserDetails()
|
public function saveUserDetails()
|
||||||
{
|
{
|
||||||
|
/** @var \App\Models\User $user */
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
$rules = ['email' => 'email|required|unique:users,email,'.$user->id.',id'];
|
$rules = ['email' => 'email|required|unique:users,email,'.$user->id.',id'];
|
||||||
$validator = Validator::make(Input::all(), $rules);
|
$validator = Validator::make(Input::all(), $rules);
|
||||||
@ -1117,9 +1258,14 @@ class AccountController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
private function saveLocalization()
|
private function saveLocalization()
|
||||||
{
|
{
|
||||||
|
/** @var \App\Models\Account $account */
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
|
|
||||||
$account->timezone_id = Input::get('timezone_id') ? Input::get('timezone_id') : null;
|
$account->timezone_id = Input::get('timezone_id') ? Input::get('timezone_id') : null;
|
||||||
$account->date_format_id = Input::get('date_format_id') ? Input::get('date_format_id') : null;
|
$account->date_format_id = Input::get('date_format_id') ? Input::get('date_format_id') : null;
|
||||||
$account->datetime_format_id = Input::get('datetime_format_id') ? Input::get('datetime_format_id') : null;
|
$account->datetime_format_id = Input::get('datetime_format_id') ? Input::get('datetime_format_id') : null;
|
||||||
@ -1136,6 +1282,9 @@ class AccountController extends BaseController
|
|||||||
return Redirect::to('settings/'.ACCOUNT_LOCALIZATION);
|
return Redirect::to('settings/'.ACCOUNT_LOCALIZATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
private function saveOnlinePayments()
|
private function saveOnlinePayments()
|
||||||
{
|
{
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
@ -1150,6 +1299,9 @@ class AccountController extends BaseController
|
|||||||
return Redirect::to('settings/'.ACCOUNT_PAYMENTS);
|
return Redirect::to('settings/'.ACCOUNT_PAYMENTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
public function removeLogo()
|
public function removeLogo()
|
||||||
{
|
{
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
@ -1168,25 +1320,33 @@ class AccountController extends BaseController
|
|||||||
return Redirect::to('settings/'.ACCOUNT_COMPANY_DETAILS);
|
return Redirect::to('settings/'.ACCOUNT_COMPANY_DETAILS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function checkEmail()
|
public function checkEmail()
|
||||||
{
|
{
|
||||||
$email = User::withTrashed()->where('email', '=', Input::get('email'))->where('id', '<>', Auth::user()->id)->first();
|
$email = User::withTrashed()->where('email', '=', Input::get('email'))
|
||||||
|
->where('id', '<>', Auth::user()->id)
|
||||||
|
->first();
|
||||||
|
|
||||||
if ($email) {
|
if ($email) {
|
||||||
return "taken";
|
return 'taken';
|
||||||
} else {
|
} else {
|
||||||
return "available";
|
return 'available';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function submitSignup()
|
public function submitSignup()
|
||||||
{
|
{
|
||||||
$rules = array(
|
$rules = [
|
||||||
'new_first_name' => 'required',
|
'new_first_name' => 'required',
|
||||||
'new_last_name' => 'required',
|
'new_last_name' => 'required',
|
||||||
'new_password' => 'required|min:6',
|
'new_password' => 'required|min:6',
|
||||||
'new_email' => 'email|required|unique:users,email,'.Auth::user()->id.',id',
|
'new_email' => 'email|required|unique:users,email,'.Auth::user()->id.',id',
|
||||||
);
|
];
|
||||||
|
|
||||||
$validator = Validator::make(Input::all(), $rules);
|
$validator = Validator::make(Input::all(), $rules);
|
||||||
|
|
||||||
@ -1194,6 +1354,7 @@ class AccountController extends BaseController
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @var \App\Models\User $user */
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
$user->first_name = trim(Input::get('new_first_name'));
|
$user->first_name = trim(Input::get('new_first_name'));
|
||||||
$user->last_name = trim(Input::get('new_last_name'));
|
$user->last_name = trim(Input::get('new_last_name'));
|
||||||
@ -1212,6 +1373,9 @@ class AccountController extends BaseController
|
|||||||
return "{$user->first_name} {$user->last_name}";
|
return "{$user->first_name} {$user->last_name}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
public function doRegister()
|
public function doRegister()
|
||||||
{
|
{
|
||||||
$affiliate = Affiliate::where('affiliate_key', '=', SELF_HOST_AFFILIATE_KEY)->first();
|
$affiliate = Affiliate::where('affiliate_key', '=', SELF_HOST_AFFILIATE_KEY)->first();
|
||||||
@ -1235,6 +1399,9 @@ class AccountController extends BaseController
|
|||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
public function cancelAccount()
|
public function cancelAccount()
|
||||||
{
|
{
|
||||||
if ($reason = trim(Input::get('reason'))) {
|
if ($reason = trim(Input::get('reason'))) {
|
||||||
@ -1275,16 +1442,25 @@ class AccountController extends BaseController
|
|||||||
return Redirect::to('/')->with('clearGuestKey', true);
|
return Redirect::to('/')->with('clearGuestKey', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
public function resendConfirmation()
|
public function resendConfirmation()
|
||||||
{
|
{
|
||||||
|
/** @var \App\Models\User $user */
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
$this->userMailer->sendConfirmation($user);
|
$this->userMailer->sendConfirmation($user);
|
||||||
|
|
||||||
return Redirect::to('/settings/'.ACCOUNT_USER_DETAILS)->with('message', trans('texts.confirmation_resent'));
|
return Redirect::to('/settings/'.ACCOUNT_USER_DETAILS)->with('message', trans('texts.confirmation_resent'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $plan
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
public function startTrial($plan)
|
public function startTrial($plan)
|
||||||
{
|
{
|
||||||
|
/** @var \App\Models\User $user */
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
|
|
||||||
if ($user->isEligibleForTrial($plan)) {
|
if ($user->isEligibleForTrial($plan)) {
|
||||||
@ -1294,6 +1470,11 @@ class AccountController extends BaseController
|
|||||||
return Redirect::back()->with('message', trans('texts.trial_success'));
|
return Redirect::back()->with('message', trans('texts.trial_success'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $section
|
||||||
|
* @param bool $subSection
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
public function redirectLegacy($section, $subSection = false)
|
public function redirectLegacy($section, $subSection = false)
|
||||||
{
|
{
|
||||||
if ($section === 'details') {
|
if ($section === 'details') {
|
||||||
@ -1314,7 +1495,11 @@ class AccountController extends BaseController
|
|||||||
return Redirect::to("/settings/$section/", 301);
|
return Redirect::to("/settings/$section/", 301);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function previewEmail(\App\Services\TemplateService $templateService)
|
/**
|
||||||
|
* @param TemplateService $templateService
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function previewEmail(TemplateService $templateService)
|
||||||
{
|
{
|
||||||
$template = Input::get('template');
|
$template = Input::get('template');
|
||||||
$invoice = Invoice::scope()
|
$invoice = Invoice::scope()
|
||||||
@ -1326,6 +1511,7 @@ class AccountController extends BaseController
|
|||||||
return trans('texts.create_invoice_for_sample');
|
return trans('texts.create_invoice_for_sample');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @var \App\Models\Account $account */
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
$invitation = $invoice->invitations->first();
|
$invitation = $invoice->invitations->first();
|
||||||
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
<?php namespace App\Http\Controllers;
|
<?php namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Auth;
|
use Auth;
|
||||||
use Datatable;
|
|
||||||
use DB;
|
|
||||||
use Input;
|
use Input;
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use Session;
|
use Session;
|
||||||
@ -15,8 +13,6 @@ use WePay;
|
|||||||
use App\Models\Gateway;
|
use App\Models\Gateway;
|
||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
use App\Models\AccountGateway;
|
use App\Models\AccountGateway;
|
||||||
|
|
||||||
use App\Ninja\Repositories\AccountRepository;
|
|
||||||
use App\Services\AccountGatewayService;
|
use App\Services\AccountGatewayService;
|
||||||
|
|
||||||
class AccountGatewayController extends BaseController
|
class AccountGatewayController extends BaseController
|
||||||
@ -173,7 +169,7 @@ class AccountGatewayController extends BaseController
|
|||||||
$gatewayId = Input::get('primary_gateway_id') ?: Input::get('secondary_gateway_id');
|
$gatewayId = Input::get('primary_gateway_id') ?: Input::get('secondary_gateway_id');
|
||||||
$gateway = Gateway::findOrFail($gatewayId);
|
$gateway = Gateway::findOrFail($gatewayId);
|
||||||
|
|
||||||
$rules = array();
|
$rules = [];
|
||||||
$fields = $gateway->getFields();
|
$fields = $gateway->getFields();
|
||||||
$optional = array_merge(Gateway::$hiddenFields, Gateway::$optionalFields);
|
$optional = array_merge(Gateway::$hiddenFields, Gateway::$optionalFields);
|
||||||
|
|
||||||
@ -334,11 +330,11 @@ class AccountGatewayController extends BaseController
|
|||||||
|
|
||||||
$wepay = Utils::setupWePay($accountGateway);
|
$wepay = Utils::setupWePay($accountGateway);
|
||||||
|
|
||||||
$update_uri_data = $wepay->request('account/get_update_uri', array(
|
$update_uri_data = $wepay->request('account/get_update_uri', [
|
||||||
'account_id' => $accountGateway->getConfig()->accountId,
|
'account_id' => $accountGateway->getConfig()->accountId,
|
||||||
'mode' => 'iframe',
|
'mode' => 'iframe',
|
||||||
'redirect_uri' => URL::to('/gateways'),
|
'redirect_uri' => URL::to('/gateways'),
|
||||||
));
|
]);
|
||||||
|
|
||||||
return $update_uri_data->uri;
|
return $update_uri_data->uri;
|
||||||
}
|
}
|
||||||
@ -348,14 +344,14 @@ class AccountGatewayController extends BaseController
|
|||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
$account = $user->account;
|
$account = $user->account;
|
||||||
|
|
||||||
$rules = array(
|
$rules = [
|
||||||
'company_name' => 'required',
|
'company_name' => 'required',
|
||||||
'description' => 'required',
|
'description' => 'required',
|
||||||
'tos_agree' => 'required',
|
'tos_agree' => 'required',
|
||||||
'first_name' => 'required',
|
'first_name' => 'required',
|
||||||
'last_name' => 'required',
|
'last_name' => 'required',
|
||||||
'email' => 'required',
|
'email' => 'required',
|
||||||
);
|
];
|
||||||
|
|
||||||
if (WEPAY_ENABLE_CANADA) {
|
if (WEPAY_ENABLE_CANADA) {
|
||||||
$rules['country'] = 'required|in:US,CA';
|
$rules['country'] = 'required|in:US,CA';
|
||||||
@ -372,7 +368,7 @@ class AccountGatewayController extends BaseController
|
|||||||
try{
|
try{
|
||||||
$wepay = Utils::setupWePay();
|
$wepay = Utils::setupWePay();
|
||||||
|
|
||||||
$userDetails = array(
|
$userDetails = [
|
||||||
'client_id' => WEPAY_CLIENT_ID,
|
'client_id' => WEPAY_CLIENT_ID,
|
||||||
'client_secret' => WEPAY_CLIENT_SECRET,
|
'client_secret' => WEPAY_CLIENT_SECRET,
|
||||||
'email' => Input::get('email'),
|
'email' => Input::get('email'),
|
||||||
@ -383,7 +379,7 @@ class AccountGatewayController extends BaseController
|
|||||||
'tos_acceptance_time' => time(),
|
'tos_acceptance_time' => time(),
|
||||||
'redirect_uri' => URL::to('gateways'),
|
'redirect_uri' => URL::to('gateways'),
|
||||||
'scope' => 'manage_accounts,collect_payments,view_user,preapprove_payments,send_money',
|
'scope' => 'manage_accounts,collect_payments,view_user,preapprove_payments,send_money',
|
||||||
);
|
];
|
||||||
|
|
||||||
$wepayUser = $wepay->request('user/register/', $userDetails);
|
$wepayUser = $wepay->request('user/register/', $userDetails);
|
||||||
|
|
||||||
@ -392,12 +388,12 @@ class AccountGatewayController extends BaseController
|
|||||||
|
|
||||||
$wepay = new WePay($accessToken);
|
$wepay = new WePay($accessToken);
|
||||||
|
|
||||||
$accountDetails = array(
|
$accountDetails = [
|
||||||
'name' => Input::get('company_name'),
|
'name' => Input::get('company_name'),
|
||||||
'description' => Input::get('description'),
|
'description' => Input::get('description'),
|
||||||
'theme_object' => json_decode(WEPAY_THEME),
|
'theme_object' => json_decode(WEPAY_THEME),
|
||||||
'callback_uri' => $accountGateway->getWebhookUrl(),
|
'callback_uri' => $accountGateway->getWebhookUrl(),
|
||||||
);
|
];
|
||||||
|
|
||||||
if (WEPAY_ENABLE_CANADA) {
|
if (WEPAY_ENABLE_CANADA) {
|
||||||
$accountDetails['country'] = Input::get('country');
|
$accountDetails['country'] = Input::get('country');
|
||||||
@ -422,7 +418,7 @@ class AccountGatewayController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$accountGateway->gateway_id = GATEWAY_WEPAY;
|
$accountGateway->gateway_id = GATEWAY_WEPAY;
|
||||||
$accountGateway->setConfig(array(
|
$accountGateway->setConfig([
|
||||||
'userId' => $wepayUser->user_id,
|
'userId' => $wepayUser->user_id,
|
||||||
'accessToken' => $accessToken,
|
'accessToken' => $accessToken,
|
||||||
'tokenType' => $wepayUser->token_type,
|
'tokenType' => $wepayUser->token_type,
|
||||||
@ -431,15 +427,15 @@ class AccountGatewayController extends BaseController
|
|||||||
'state' => $wepayAccount->state,
|
'state' => $wepayAccount->state,
|
||||||
'testMode' => WEPAY_ENVIRONMENT == WEPAY_STAGE,
|
'testMode' => WEPAY_ENVIRONMENT == WEPAY_STAGE,
|
||||||
'country' => WEPAY_ENABLE_CANADA ? Input::get('country') : 'US',
|
'country' => WEPAY_ENABLE_CANADA ? Input::get('country') : 'US',
|
||||||
));
|
]);
|
||||||
|
|
||||||
if ($confirmationRequired) {
|
if ($confirmationRequired) {
|
||||||
Session::flash('message', trans('texts.created_wepay_confirmation_required'));
|
Session::flash('message', trans('texts.created_wepay_confirmation_required'));
|
||||||
} else {
|
} else {
|
||||||
$updateUri = $wepay->request('/account/get_update_uri', array(
|
$updateUri = $wepay->request('/account/get_update_uri', [
|
||||||
'account_id' => $wepayAccount->account_id,
|
'account_id' => $wepayAccount->account_id,
|
||||||
'redirect_uri' => URL::to('gateways'),
|
'redirect_uri' => URL::to('gateways'),
|
||||||
));
|
]);
|
||||||
|
|
||||||
$response = Redirect::to($updateUri->uri);
|
$response = Redirect::to($updateUri->uri);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
<?php namespace App\Http\Controllers;
|
<?php namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
use DB;
|
|
||||||
use Datatable;
|
|
||||||
use Utils;
|
|
||||||
use View;
|
|
||||||
use App\Models\Client;
|
|
||||||
use App\Models\Activity;
|
|
||||||
use App\Services\ActivityService;
|
use App\Services\ActivityService;
|
||||||
|
|
||||||
class ActivityController extends BaseController
|
class ActivityController extends BaseController
|
||||||
|
@ -11,10 +11,8 @@ use Utils;
|
|||||||
use View;
|
use View;
|
||||||
use Event;
|
use Event;
|
||||||
use Session;
|
use Session;
|
||||||
use Cookie;
|
|
||||||
use Response;
|
use Response;
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use App\Models\User;
|
|
||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
use App\Models\Industry;
|
use App\Models\Industry;
|
||||||
use App\Ninja\Mailers\Mailer;
|
use App\Ninja\Mailers\Mailer;
|
||||||
@ -114,18 +112,18 @@ class AppController extends BaseController
|
|||||||
|
|
||||||
|
|
||||||
// Write Config Settings
|
// Write Config Settings
|
||||||
$fp = fopen(base_path()."/.env", 'w');
|
$fp = fopen(base_path().'/.env', 'w');
|
||||||
fwrite($fp, $config);
|
fwrite($fp, $config);
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
// == DB Migrate & Seed == //
|
// == DB Migrate & Seed == //
|
||||||
// Artisan::call('migrate:rollback', array('--force' => true)); // Debug Purposes
|
// Artisan::call('migrate:rollback', array('--force' => true)); // Debug Purposes
|
||||||
Artisan::call('migrate', array('--force' => true));
|
Artisan::call('migrate', ['--force' => true]);
|
||||||
if (Industry::count() == 0) {
|
if (Industry::count() == 0) {
|
||||||
Artisan::call('db:seed', array('--force' => true));
|
Artisan::call('db:seed', ['--force' => true]);
|
||||||
}
|
}
|
||||||
Cache::flush();
|
Cache::flush();
|
||||||
Artisan::call('optimize', array('--force' => true));
|
Artisan::call('optimize', ['--force' => true]);
|
||||||
|
|
||||||
$firstName = trim(Input::get('first_name'));
|
$firstName = trim(Input::get('first_name'));
|
||||||
$lastName = trim(Input::get('last_name'));
|
$lastName = trim(Input::get('last_name'));
|
||||||
@ -147,7 +145,7 @@ class AppController extends BaseController
|
|||||||
return Redirect::to('/');
|
return Redirect::to('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! $canUpdateEnv = @fopen(base_path()."/.env", 'w')) {
|
if ( ! $canUpdateEnv = @fopen(base_path().'/.env', 'w')) {
|
||||||
Session::flash('error', 'Warning: Permission denied to write to .env config file, try running <code>sudo chown www-data:www-data /path/to/ninja/.env</code>');
|
Session::flash('error', 'Warning: Permission denied to write to .env config file, try running <code>sudo chown www-data:www-data /path/to/ninja/.env</code>');
|
||||||
return Redirect::to('/settings/system_settings');
|
return Redirect::to('/settings/system_settings');
|
||||||
}
|
}
|
||||||
@ -187,7 +185,7 @@ class AppController extends BaseController
|
|||||||
$config .= "{$key}={$val}\n";
|
$config .= "{$key}={$val}\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$fp = fopen(base_path()."/.env", 'w');
|
$fp = fopen(base_path().'/.env', 'w');
|
||||||
fwrite($fp, $config);
|
fwrite($fp, $config);
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
@ -243,11 +241,11 @@ class AppController extends BaseController
|
|||||||
if (!Utils::isNinjaProd() && !Utils::isDatabaseSetup()) {
|
if (!Utils::isNinjaProd() && !Utils::isDatabaseSetup()) {
|
||||||
try {
|
try {
|
||||||
set_time_limit(60 * 5); // shouldn't take this long but just in case
|
set_time_limit(60 * 5); // shouldn't take this long but just in case
|
||||||
Artisan::call('migrate', array('--force' => true));
|
Artisan::call('migrate', ['--force' => true]);
|
||||||
if (Industry::count() == 0) {
|
if (Industry::count() == 0) {
|
||||||
Artisan::call('db:seed', array('--force' => true));
|
Artisan::call('db:seed', ['--force' => true]);
|
||||||
}
|
}
|
||||||
Artisan::call('optimize', array('--force' => true));
|
Artisan::call('optimize', ['--force' => true]);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Utils::logError($e);
|
Utils::logError($e);
|
||||||
return Response::make($e->getMessage(), 500);
|
return Response::make($e->getMessage(), 500);
|
||||||
@ -268,11 +266,11 @@ class AppController extends BaseController
|
|||||||
Artisan::call('route:clear');
|
Artisan::call('route:clear');
|
||||||
Artisan::call('view:clear');
|
Artisan::call('view:clear');
|
||||||
Artisan::call('config:clear');
|
Artisan::call('config:clear');
|
||||||
Artisan::call('optimize', array('--force' => true));
|
Artisan::call('optimize', ['--force' => true]);
|
||||||
Cache::flush();
|
Cache::flush();
|
||||||
Session::flush();
|
Session::flush();
|
||||||
Artisan::call('migrate', array('--force' => true));
|
Artisan::call('migrate', ['--force' => true]);
|
||||||
Artisan::call('db:seed', array('--force' => true, '--class' => "UpdateSeeder"));
|
Artisan::call('db:seed', ['--force' => true, '--class' => 'UpdateSeeder']);
|
||||||
Event::fire(new UserSettingsChanged());
|
Event::fire(new UserSettingsChanged());
|
||||||
|
|
||||||
// show message with link to Trello board
|
// show message with link to Trello board
|
||||||
|
@ -12,40 +12,55 @@ use App\Ninja\Repositories\AccountRepository;
|
|||||||
use App\Services\AuthService;
|
use App\Services\AuthService;
|
||||||
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
|
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
|
||||||
|
|
||||||
class AuthController extends Controller {
|
class AuthController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Registration & Login Controller
|
| Registration & Login Controller
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| This controller handles the registration of new users, as well as the
|
| This controller handles the registration of new users, as well as the
|
||||||
| authentication of existing users. By default, this controller uses
|
| authentication of existing users. By default, this controller uses
|
||||||
| a simple trait to add these behaviors. Why don't you explore it?
|
| a simple trait to add these behaviors. Why don't you explore it?
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use AuthenticatesAndRegistersUsers;
|
use AuthenticatesAndRegistersUsers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $redirectTo = '/dashboard';
|
protected $redirectTo = '/dashboard';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var AuthService
|
||||||
|
*/
|
||||||
protected $authService;
|
protected $authService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var AccountRepository
|
||||||
|
*/
|
||||||
protected $accountRepo;
|
protected $accountRepo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new authentication controller instance.
|
* Create a new authentication controller instance.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Contracts\Auth\Guard $auth
|
* @param AccountRepository $repo
|
||||||
* @param \Illuminate\Contracts\Auth\Registrar $registrar
|
* @param AuthService $authService
|
||||||
* @return void
|
* @internal param \Illuminate\Contracts\Auth\Guard $auth
|
||||||
*/
|
* @internal param \Illuminate\Contracts\Auth\Registrar $registrar
|
||||||
public function __construct(AccountRepository $repo, AuthService $authService)
|
*/
|
||||||
{
|
public function __construct(AccountRepository $repo, AuthService $authService)
|
||||||
|
{
|
||||||
$this->accountRepo = $repo;
|
$this->accountRepo = $repo;
|
||||||
$this->authService = $authService;
|
$this->authService = $authService;
|
||||||
|
}
|
||||||
|
|
||||||
//$this->middleware('guest', ['except' => 'getLogout']);
|
/**
|
||||||
}
|
* @param array $data
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
public function validator(array $data)
|
public function validator(array $data)
|
||||||
{
|
{
|
||||||
return Validator::make($data, [
|
return Validator::make($data, [
|
||||||
@ -58,7 +73,8 @@ class AuthController extends Controller {
|
|||||||
/**
|
/**
|
||||||
* Create a new user instance after a valid registration.
|
* Create a new user instance after a valid registration.
|
||||||
*
|
*
|
||||||
* @param array $data
|
* @param array $data
|
||||||
|
*
|
||||||
* @return User
|
* @return User
|
||||||
*/
|
*/
|
||||||
public function create(array $data)
|
public function create(array $data)
|
||||||
@ -70,11 +86,20 @@ class AuthController extends Controller {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $provider
|
||||||
|
* @param Request $request
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
public function authLogin($provider, Request $request)
|
public function authLogin($provider, Request $request)
|
||||||
{
|
{
|
||||||
return $this->authService->execute($provider, $request->has('code'));
|
return $this->authService->execute($provider, $request->has('code'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
public function authUnlink()
|
public function authUnlink()
|
||||||
{
|
{
|
||||||
$this->accountRepo->unlinkUserFromOauth(Auth::user());
|
$this->accountRepo->unlinkUserFromOauth(Auth::user());
|
||||||
@ -83,6 +108,9 @@ class AuthController extends Controller {
|
|||||||
return redirect()->to('/settings/' . ACCOUNT_USER_DETAILS);
|
return redirect()->to('/settings/' . ACCOUNT_USER_DETAILS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
public function getLoginWrapper()
|
public function getLoginWrapper()
|
||||||
{
|
{
|
||||||
if (!Utils::isNinja() && !User::count()) {
|
if (!Utils::isNinja() && !User::count()) {
|
||||||
@ -92,6 +120,11 @@ class AuthController extends Controller {
|
|||||||
return self::getLogin();
|
return self::getLogin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Request $request
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
public function postLoginWrapper(Request $request)
|
public function postLoginWrapper(Request $request)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -113,7 +146,7 @@ class AuthController extends Controller {
|
|||||||
if ($request->link_accounts && $userId && Auth::user()->id != $userId) {
|
if ($request->link_accounts && $userId && Auth::user()->id != $userId) {
|
||||||
$users = $this->accountRepo->associateAccounts($userId, Auth::user()->id);
|
$users = $this->accountRepo->associateAccounts($userId, Auth::user()->id);
|
||||||
Session::flash('message', trans('texts.associated_accounts'));
|
Session::flash('message', trans('texts.associated_accounts'));
|
||||||
// check if other accounts are linked
|
// check if other accounts are linked
|
||||||
} else {
|
} else {
|
||||||
$users = $this->accountRepo->loadAccounts(Auth::user()->id);
|
$users = $this->accountRepo->loadAccounts(Auth::user()->id);
|
||||||
}
|
}
|
||||||
@ -127,14 +160,16 @@ class AuthController extends Controller {
|
|||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
public function getLogoutWrapper()
|
public function getLogoutWrapper()
|
||||||
{
|
{
|
||||||
if (Auth::check() && !Auth::user()->registered) {
|
if (Auth::check() && !Auth::user()->registered) {
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
$this->accountRepo->unlinkAccount($account);
|
$this->accountRepo->unlinkAccount($account);
|
||||||
if ($account->company->accounts->count() == 1) {
|
if ($account->company->accounts->count() == 1) {
|
||||||
$account->company->forceDelete();
|
$account->company->forceDelete();
|
||||||
}
|
}
|
||||||
$account->forceDelete();
|
$account->forceDelete();
|
||||||
}
|
}
|
||||||
|
@ -3,33 +3,36 @@
|
|||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use Illuminate\Foundation\Auth\ResetsPasswords;
|
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||||
|
|
||||||
class PasswordController extends Controller {
|
class PasswordController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Password Reset Controller
|
| Password Reset Controller
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| This controller is responsible for handling password reset requests
|
| This controller is responsible for handling password reset requests
|
||||||
| and uses a simple trait to include this behavior. You're free to
|
| and uses a simple trait to include this behavior. You're free to
|
||||||
| explore this trait and override any methods you wish to tweak.
|
| explore this trait and override any methods you wish to tweak.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use ResetsPasswords;
|
use ResetsPasswords;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $redirectTo = '/dashboard';
|
protected $redirectTo = '/dashboard';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new password controller instance.
|
* Create a new password controller instance.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Contracts\Auth\Guard $auth
|
* @internal param \Illuminate\Contracts\Auth\Guard $auth
|
||||||
* @param \Illuminate\Contracts\Auth\PasswordBroker $passwords
|
* @internal param \Illuminate\Contracts\Auth\PasswordBroker $passwords
|
||||||
* @return void
|
*/
|
||||||
*/
|
public function __construct()
|
||||||
public function __construct()
|
{
|
||||||
{
|
$this->middleware('guest');
|
||||||
$this->middleware('guest');
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,19 +2,12 @@
|
|||||||
|
|
||||||
use Cache;
|
use Cache;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Datatable;
|
|
||||||
use DB;
|
|
||||||
use Input;
|
use Input;
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use Session;
|
use Session;
|
||||||
use View;
|
use View;
|
||||||
use Validator;
|
|
||||||
use stdClass;
|
|
||||||
use Crypt;
|
use Crypt;
|
||||||
use URL;
|
|
||||||
use Utils;
|
|
||||||
use File;
|
use File;
|
||||||
use App\Models\Gateway;
|
|
||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
use App\Models\BankAccount;
|
use App\Models\BankAccount;
|
||||||
use App\Ninja\Repositories\BankAccountRepository;
|
use App\Ninja\Repositories\BankAccountRepository;
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
<?php namespace App\Http\Controllers;
|
<?php namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Session;
|
|
||||||
use Utils;
|
use Utils;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Log;
|
|
||||||
use Input;
|
use Input;
|
||||||
use Response;
|
use Response;
|
||||||
use Request;
|
use Request;
|
||||||
use League\Fractal;
|
|
||||||
use League\Fractal\Manager;
|
use League\Fractal\Manager;
|
||||||
use League\Fractal\Resource\Item;
|
use League\Fractal\Resource\Item;
|
||||||
use League\Fractal\Resource\Collection;
|
use League\Fractal\Resource\Collection;
|
||||||
@ -15,7 +12,6 @@ use League\Fractal\Pagination\IlluminatePaginatorAdapter;
|
|||||||
use App\Models\EntityModel;
|
use App\Models\EntityModel;
|
||||||
use App\Ninja\Serializers\ArraySerializer;
|
use App\Ninja\Serializers\ArraySerializer;
|
||||||
use League\Fractal\Serializer\JsonApiSerializer;
|
use League\Fractal\Serializer\JsonApiSerializer;
|
||||||
use Illuminate\Pagination\LengthAwarePaginator;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @SWG\Swagger(
|
* @SWG\Swagger(
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
<?php namespace App\Http\Controllers;
|
<?php namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Http\Middleware\PermissionsRequired;
|
|
||||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||||
use Input;
|
|
||||||
use Auth;
|
|
||||||
use Utils;
|
|
||||||
|
|
||||||
class BaseController extends Controller
|
class BaseController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -1,15 +1,10 @@
|
|||||||
<?php namespace App\Http\Controllers;
|
<?php namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
|
||||||
use Utils;
|
|
||||||
use Response;
|
use Response;
|
||||||
use Input;
|
use Input;
|
||||||
use Auth;
|
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Ninja\Repositories\ClientRepository;
|
use App\Ninja\Repositories\ClientRepository;
|
||||||
use App\Http\Requests\CreateClientRequest;
|
use App\Http\Requests\CreateClientRequest;
|
||||||
use App\Http\Controllers\BaseAPIController;
|
|
||||||
use App\Ninja\Transformers\ClientTransformer;
|
|
||||||
use App\Http\Requests\UpdateClientRequest;
|
use App\Http\Requests\UpdateClientRequest;
|
||||||
|
|
||||||
class ClientApiController extends BaseAPIController
|
class ClientApiController extends BaseAPIController
|
||||||
|
@ -1,31 +1,35 @@
|
|||||||
<?php namespace App\Http\Controllers\ClientAuth;
|
<?php namespace App\Http\Controllers\ClientAuth;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
use Event;
|
|
||||||
use Utils;
|
|
||||||
use Session;
|
use Session;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Events\UserLoggedIn;
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Ninja\Repositories\AccountRepository;
|
|
||||||
use App\Services\AuthService;
|
|
||||||
use App\Models\Contact;
|
use App\Models\Contact;
|
||||||
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
||||||
|
|
||||||
class AuthController extends Controller {
|
class AuthController extends Controller
|
||||||
|
{
|
||||||
|
use AuthenticatesUsers;
|
||||||
|
|
||||||
protected $guard = 'client';
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $guard = 'client';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $redirectTo = '/client/dashboard';
|
protected $redirectTo = '/client/dashboard';
|
||||||
|
|
||||||
use AuthenticatesUsers;
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function showLoginForm()
|
||||||
|
{
|
||||||
|
$data = [];
|
||||||
|
|
||||||
public function showLoginForm()
|
|
||||||
{
|
|
||||||
$data = array();
|
|
||||||
|
|
||||||
$contactKey = session('contact_key');
|
$contactKey = session('contact_key');
|
||||||
if($contactKey){
|
if ($contactKey) {
|
||||||
$contact = Contact::where('contact_key', '=', $contactKey)->first();
|
$contact = Contact::where('contact_key', '=', $contactKey)->first();
|
||||||
if ($contact && !$contact->is_deleted) {
|
if ($contact && !$contact->is_deleted) {
|
||||||
$account = $contact->account;
|
$account = $contact->account;
|
||||||
@ -34,14 +38,15 @@ class AuthController extends Controller {
|
|||||||
$data['clientFontUrl'] = $account->getFontsUrl();
|
$data['clientFontUrl'] = $account->getFontsUrl();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('clientauth.login')->with($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
return view('clientauth.login')->with($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
* Get the needed authorization credentials from the request.
|
* Get the needed authorization credentials from the request.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function getCredentials(Request $request)
|
protected function getCredentials(Request $request)
|
||||||
@ -50,20 +55,21 @@ class AuthController extends Controller {
|
|||||||
$credentials['id'] = null;
|
$credentials['id'] = null;
|
||||||
|
|
||||||
$contactKey = session('contact_key');
|
$contactKey = session('contact_key');
|
||||||
if($contactKey){
|
if ($contactKey) {
|
||||||
$contact = Contact::where('contact_key', '=', $contactKey)->first();
|
$contact = Contact::where('contact_key', '=', $contactKey)->first();
|
||||||
if ($contact && !$contact->is_deleted) {
|
if ($contact && !$contact->is_deleted) {
|
||||||
$credentials['id'] = $contact->id;
|
$credentials['id'] = $contact->id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $credentials;
|
return $credentials;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate the user login request.
|
* Validate the user login request.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function validateLogin(Request $request)
|
protected function validateLogin(Request $request)
|
||||||
@ -73,6 +79,9 @@ class AuthController extends Controller {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
public function getSessionExpired()
|
public function getSessionExpired()
|
||||||
{
|
{
|
||||||
return view('clientauth.sessionexpired');
|
return view('clientauth.sessionexpired');
|
||||||
|
@ -9,42 +9,47 @@ use Illuminate\Support\Facades\Password;
|
|||||||
use App\Models\Contact;
|
use App\Models\Contact;
|
||||||
use App\Models\Invitation;
|
use App\Models\Invitation;
|
||||||
|
|
||||||
|
class PasswordController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
class PasswordController extends Controller {
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Password Reset Controller
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This controller is responsible for handling password reset requests
|
||||||
|
| and uses a simple trait to include this behavior. You're free to
|
||||||
|
| explore this trait and override any methods you wish to tweak.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
use ResetsPasswords;
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Password Reset Controller
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| This controller is responsible for handling password reset requests
|
|
||||||
| and uses a simple trait to include this behavior. You're free to
|
|
||||||
| explore this trait and override any methods you wish to tweak.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
use ResetsPasswords;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $redirectTo = '/client/dashboard';
|
protected $redirectTo = '/client/dashboard';
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new password controller instance.
|
|
||||||
*
|
|
||||||
* @param \Illuminate\Contracts\Auth\Guard $auth
|
|
||||||
* @param \Illuminate\Contracts\Auth\PasswordBroker $passwords
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
$this->middleware('guest');
|
|
||||||
Config::set("auth.defaults.passwords","client");
|
|
||||||
}
|
|
||||||
|
|
||||||
public function showLinkRequestForm()
|
/**
|
||||||
{
|
* Create a new password controller instance.
|
||||||
$data = array();
|
*
|
||||||
|
* @internal param \Illuminate\Contracts\Auth\Guard $auth
|
||||||
|
* @internal param \Illuminate\Contracts\Auth\PasswordBroker $passwords
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->middleware('guest');
|
||||||
|
Config::set('auth.defaults.passwords', 'client');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
|
public function showLinkRequestForm()
|
||||||
|
{
|
||||||
|
$data = [];
|
||||||
$contactKey = session('contact_key');
|
$contactKey = session('contact_key');
|
||||||
if($contactKey){
|
if ($contactKey) {
|
||||||
$contact = Contact::where('contact_key', '=', $contactKey)->first();
|
$contact = Contact::where('contact_key', '=', $contactKey)->first();
|
||||||
if ($contact && !$contact->is_deleted) {
|
if ($contact && !$contact->is_deleted) {
|
||||||
$account = $contact->account;
|
$account = $contact->account;
|
||||||
@ -54,14 +59,15 @@ class PasswordController extends Controller {
|
|||||||
} else {
|
} else {
|
||||||
return \Redirect::to('/client/sessionexpired');
|
return \Redirect::to('/client/sessionexpired');
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('clientauth.password')->with($data);
|
return view('clientauth.password')->with($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a reset link to the given user.
|
* Send a reset link to the given user.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
|
*
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function sendResetLinkEmail(Request $request)
|
public function sendResetLinkEmail(Request $request)
|
||||||
@ -70,14 +76,14 @@ class PasswordController extends Controller {
|
|||||||
|
|
||||||
$contactId = null;
|
$contactId = null;
|
||||||
$contactKey = session('contact_key');
|
$contactKey = session('contact_key');
|
||||||
if($contactKey){
|
if ($contactKey) {
|
||||||
$contact = Contact::where('contact_key', '=', $contactKey)->first();
|
$contact = Contact::where('contact_key', '=', $contactKey)->first();
|
||||||
if ($contact && !$contact->is_deleted) {
|
if ($contact && !$contact->is_deleted) {
|
||||||
$contactId = $contact->id;
|
$contactId = $contact->id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = Password::broker($broker)->sendResetLink(array('id'=>$contactId), function (Message $message) {
|
$response = Password::broker($broker)->sendResetLink(['id' => $contactId], function (Message $message) {
|
||||||
$message->subject($this->getEmailSubject());
|
$message->subject($this->getEmailSubject());
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -90,15 +96,15 @@ class PasswordController extends Controller {
|
|||||||
return $this->getSendResetLinkEmailFailureResponse($response);
|
return $this->getSendResetLinkEmailFailureResponse($response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display the password reset view for the given token.
|
* Display the password reset view for the given token.
|
||||||
*
|
*
|
||||||
* If no token is present, display the link request form.
|
* If no token is present, display the link request form.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
* @param string|null $key
|
* @param string|null $key
|
||||||
* @param string|null $token
|
* @param string|null $token
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function showResetForm(Request $request, $key = null, $token = null)
|
public function showResetForm(Request $request, $key = null, $token = null)
|
||||||
@ -106,9 +112,9 @@ class PasswordController extends Controller {
|
|||||||
if (is_null($token)) {
|
if (is_null($token)) {
|
||||||
return $this->getEmail();
|
return $this->getEmail();
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = compact('token');
|
$data = compact('token');
|
||||||
if($key) {
|
if ($key) {
|
||||||
$contact = Contact::where('contact_key', '=', $key)->first();
|
$contact = Contact::where('contact_key', '=', $key)->first();
|
||||||
if ($contact && !$contact->is_deleted) {
|
if ($contact && !$contact->is_deleted) {
|
||||||
$account = $contact->account;
|
$account = $contact->account;
|
||||||
@ -132,28 +138,27 @@ class PasswordController extends Controller {
|
|||||||
|
|
||||||
return view('clientauth.reset')->with($data);
|
return view('clientauth.reset')->with($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display the password reset view for the given token.
|
* Display the password reset view for the given token.
|
||||||
*
|
*
|
||||||
* If no token is present, display the link request form.
|
* If no token is present, display the link request form.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
* @param string|null $key
|
* @param string|null $key
|
||||||
* @param string|null $token
|
* @param string|null $token
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function getReset(Request $request, $key = null, $token = null)
|
public function getReset(Request $request, $key = null, $token = null)
|
||||||
{
|
{
|
||||||
return $this->showResetForm($request, $key, $token);
|
return $this->showResetForm($request, $key, $token);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset the given user's password.
|
* Reset the given user's password.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function reset(Request $request)
|
public function reset(Request $request)
|
||||||
@ -163,11 +168,11 @@ class PasswordController extends Controller {
|
|||||||
$credentials = $request->only(
|
$credentials = $request->only(
|
||||||
'password', 'password_confirmation', 'token'
|
'password', 'password_confirmation', 'token'
|
||||||
);
|
);
|
||||||
|
|
||||||
$credentials['id'] = null;
|
$credentials['id'] = null;
|
||||||
|
|
||||||
$contactKey = session('contact_key');
|
$contactKey = session('contact_key');
|
||||||
if($contactKey){
|
if ($contactKey) {
|
||||||
$contact = Contact::where('contact_key', '=', $contactKey)->first();
|
$contact = Contact::where('contact_key', '=', $contactKey)->first();
|
||||||
if ($contact && !$contact->is_deleted) {
|
if ($contact && !$contact->is_deleted) {
|
||||||
$credentials['id'] = $contact->id;
|
$credentials['id'] = $contact->id;
|
||||||
@ -188,7 +193,7 @@ class PasswordController extends Controller {
|
|||||||
return $this->getResetFailureResponse($request, $response);
|
return $this->getResetFailureResponse($request, $response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the password reset validation rules.
|
* Get the password reset validation rules.
|
||||||
*
|
*
|
||||||
|
@ -1,33 +1,21 @@
|
|||||||
<?php namespace App\Http\Controllers;
|
<?php namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Auth;
|
use Auth;
|
||||||
use Datatable;
|
|
||||||
use Utils;
|
use Utils;
|
||||||
use View;
|
use View;
|
||||||
use URL;
|
use URL;
|
||||||
use Validator;
|
|
||||||
use Input;
|
use Input;
|
||||||
use Session;
|
use Session;
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use Cache;
|
use Cache;
|
||||||
|
|
||||||
use App\Models\Activity;
|
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
use App\Models\Contact;
|
use App\Models\Contact;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Models\Size;
|
|
||||||
use App\Models\PaymentTerm;
|
|
||||||
use App\Models\Industry;
|
|
||||||
use App\Models\Currency;
|
|
||||||
use App\Models\Payment;
|
|
||||||
use App\Models\Credit;
|
use App\Models\Credit;
|
||||||
use App\Models\Expense;
|
|
||||||
use App\Models\Country;
|
|
||||||
use App\Models\Task;
|
use App\Models\Task;
|
||||||
use App\Ninja\Repositories\ClientRepository;
|
use App\Ninja\Repositories\ClientRepository;
|
||||||
use App\Services\ClientService;
|
use App\Services\ClientService;
|
||||||
|
|
||||||
use App\Http\Requests\ClientRequest;
|
use App\Http\Requests\ClientRequest;
|
||||||
use App\Http\Requests\CreateClientRequest;
|
use App\Http\Requests\CreateClientRequest;
|
||||||
use App\Http\Requests\UpdateClientRequest;
|
use App\Http\Requests\UpdateClientRequest;
|
||||||
@ -53,7 +41,7 @@ class ClientController extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
return View::make('list', array(
|
return View::make('list', [
|
||||||
'entityType' => ENTITY_CLIENT,
|
'entityType' => ENTITY_CLIENT,
|
||||||
'title' => trans('texts.clients'),
|
'title' => trans('texts.clients'),
|
||||||
'sortCol' => '4',
|
'sortCol' => '4',
|
||||||
@ -67,7 +55,7 @@ class ClientController extends BaseController
|
|||||||
'balance',
|
'balance',
|
||||||
''
|
''
|
||||||
]),
|
]),
|
||||||
));
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDatatable()
|
public function getDatatable()
|
||||||
@ -131,7 +119,7 @@ class ClientController extends BaseController
|
|||||||
|
|
||||||
$token = $client->getGatewayToken();
|
$token = $client->getGatewayToken();
|
||||||
|
|
||||||
$data = array(
|
$data = [
|
||||||
'actionLinks' => $actionLinks,
|
'actionLinks' => $actionLinks,
|
||||||
'showBreadcrumbs' => false,
|
'showBreadcrumbs' => false,
|
||||||
'client' => $client,
|
'client' => $client,
|
||||||
@ -142,7 +130,7 @@ class ClientController extends BaseController
|
|||||||
'hasTasks' => Task::scope()->whereClientId($client->id)->count() > 0,
|
'hasTasks' => Task::scope()->whereClientId($client->id)->count() > 0,
|
||||||
'gatewayLink' => $token ? $token->gatewayLink() : false,
|
'gatewayLink' => $token ? $token->gatewayLink() : false,
|
||||||
'gatewayName' => $token ? $token->gatewayName() : false,
|
'gatewayName' => $token ? $token->gatewayName() : false,
|
||||||
);
|
];
|
||||||
|
|
||||||
return View::make('clients.show', $data);
|
return View::make('clients.show', $data);
|
||||||
}
|
}
|
||||||
@ -155,7 +143,7 @@ class ClientController extends BaseController
|
|||||||
public function create(ClientRequest $request)
|
public function create(ClientRequest $request)
|
||||||
{
|
{
|
||||||
if (Client::scope()->withTrashed()->count() > Auth::user()->getMaxNumClients()) {
|
if (Client::scope()->withTrashed()->count() > Auth::user()->getMaxNumClients()) {
|
||||||
return View::make('error', ['hideHeader' => true, 'error' => "Sorry, you've exceeded the limit of ".Auth::user()->getMaxNumClients()." clients"]);
|
return View::make('error', ['hideHeader' => true, 'error' => "Sorry, you've exceeded the limit of ".Auth::user()->getMaxNumClients().' clients']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
use Auth;
|
use Auth;
|
||||||
use View;
|
use View;
|
||||||
use DB;
|
|
||||||
use URL;
|
use URL;
|
||||||
use Input;
|
use Input;
|
||||||
use Utils;
|
use Utils;
|
||||||
@ -98,7 +97,7 @@ class ClientPortalController extends BaseController
|
|||||||
'phone',
|
'phone',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$data = array();
|
$data = [];
|
||||||
$paymentTypes = $this->getPaymentTypes($account, $client, $invitation);
|
$paymentTypes = $this->getPaymentTypes($account, $client, $invitation);
|
||||||
$paymentURL = '';
|
$paymentURL = '';
|
||||||
if (count($paymentTypes) == 1) {
|
if (count($paymentTypes) == 1) {
|
||||||
@ -120,7 +119,7 @@ class ClientPortalController extends BaseController
|
|||||||
$showApprove = false;
|
$showApprove = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data += array(
|
$data += [
|
||||||
'account' => $account,
|
'account' => $account,
|
||||||
'showApprove' => $showApprove,
|
'showApprove' => $showApprove,
|
||||||
'showBreadcrumbs' => false,
|
'showBreadcrumbs' => false,
|
||||||
@ -132,7 +131,7 @@ class ClientPortalController extends BaseController
|
|||||||
'paymentTypes' => $paymentTypes,
|
'paymentTypes' => $paymentTypes,
|
||||||
'paymentURL' => $paymentURL,
|
'paymentURL' => $paymentURL,
|
||||||
'phantomjs' => Input::has('phantomjs'),
|
'phantomjs' => Input::has('phantomjs'),
|
||||||
);
|
];
|
||||||
|
|
||||||
if ($paymentDriver = $account->paymentDriver($invitation, GATEWAY_TYPE_CREDIT_CARD)) {
|
if ($paymentDriver = $account->paymentDriver($invitation, GATEWAY_TYPE_CREDIT_CARD)) {
|
||||||
$data += [
|
$data += [
|
||||||
@ -383,7 +382,7 @@ class ClientPortalController extends BaseController
|
|||||||
|
|
||||||
private function getPaymentStatusLabel($model)
|
private function getPaymentStatusLabel($model)
|
||||||
{
|
{
|
||||||
$label = trans("texts.status_" . strtolower($model->payment_status_name));
|
$label = trans('texts.status_' . strtolower($model->payment_status_name));
|
||||||
$class = 'default';
|
$class = 'default';
|
||||||
switch ($model->payment_status_id) {
|
switch ($model->payment_status_id) {
|
||||||
case PAYMENT_STATUS_PENDING:
|
case PAYMENT_STATUS_PENDING:
|
||||||
@ -512,7 +511,7 @@ class ClientPortalController extends BaseController
|
|||||||
|
|
||||||
|
|
||||||
if(!$document->isPDFEmbeddable()){
|
if(!$document->isPDFEmbeddable()){
|
||||||
return Response::view('error', array('error'=>'Image does not exist!'), 404);
|
return Response::view('error', ['error'=>'Image does not exist!'], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$authorized = false;
|
$authorized = false;
|
||||||
@ -523,7 +522,7 @@ class ClientPortalController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!$authorized){
|
if(!$authorized){
|
||||||
return Response::view('error', array('error'=>'Not authorized'), 403);
|
return Response::view('error', ['error'=>'Not authorized'], 403);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(substr($name, -3)=='.js'){
|
if(substr($name, -3)=='.js'){
|
||||||
@ -554,7 +553,7 @@ class ClientPortalController extends BaseController
|
|||||||
|
|
||||||
$size = 0;
|
$size = 0;
|
||||||
$maxSize = MAX_ZIP_DOCUMENTS_SIZE * 1000;
|
$maxSize = MAX_ZIP_DOCUMENTS_SIZE * 1000;
|
||||||
$toZip = array();
|
$toZip = [];
|
||||||
foreach($documents as $document){
|
foreach($documents as $document){
|
||||||
if($size + $document->size > $maxSize)break;
|
if($size + $document->size > $maxSize)break;
|
||||||
|
|
||||||
@ -600,7 +599,7 @@ class ClientPortalController extends BaseController
|
|||||||
$toZip = $this->getInvoiceZipDocuments($invoice);
|
$toZip = $this->getInvoiceZipDocuments($invoice);
|
||||||
|
|
||||||
if(!count($toZip)){
|
if(!count($toZip)){
|
||||||
return Response::view('error', array('error'=>'No documents small enough'), 404);
|
return Response::view('error', ['error'=>'No documents small enough'], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$zip = new ZipArchive($invitation->account->name.' Invoice '.$invoice->invoice_number.'.zip');
|
$zip = new ZipArchive($invitation->account->name.' Invoice '.$invoice->invoice_number.'.zip');
|
||||||
@ -608,7 +607,7 @@ class ClientPortalController extends BaseController
|
|||||||
foreach($toZip as $name=>$document){
|
foreach($toZip as $name=>$document){
|
||||||
$fileStream = $document->getStream();
|
$fileStream = $document->getStream();
|
||||||
if($fileStream){
|
if($fileStream){
|
||||||
$zip->init_file_stream_transfer($name, $document->size, array('time'=>$document->created_at->timestamp));
|
$zip->init_file_stream_transfer($name, $document->size, ['time'=>$document->created_at->timestamp]);
|
||||||
while ($buffer = fread($fileStream, 256000))$zip->stream_file_part($buffer);
|
while ($buffer = fread($fileStream, 256000))$zip->stream_file_part($buffer);
|
||||||
fclose($fileStream);
|
fclose($fileStream);
|
||||||
$zip->complete_file_stream();
|
$zip->complete_file_stream();
|
||||||
@ -639,7 +638,7 @@ class ClientPortalController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!$authorized){
|
if(!$authorized){
|
||||||
return Response::view('error', array('error'=>'Not authorized'), 403);
|
return Response::view('error', ['error'=>'Not authorized'], 403);
|
||||||
}
|
}
|
||||||
|
|
||||||
return DocumentController::getDownloadResponse($document);
|
return DocumentController::getDownloadResponse($document);
|
||||||
@ -657,7 +656,7 @@ class ClientPortalController extends BaseController
|
|||||||
$paymentDriver = $account->paymentDriver(false, GATEWAY_TYPE_TOKEN);
|
$paymentDriver = $account->paymentDriver(false, GATEWAY_TYPE_TOKEN);
|
||||||
$customer = $paymentDriver->customer($client->id);
|
$customer = $paymentDriver->customer($client->id);
|
||||||
|
|
||||||
$data = array(
|
$data = [
|
||||||
'account' => $account,
|
'account' => $account,
|
||||||
'contact' => $contact,
|
'contact' => $contact,
|
||||||
'color' => $account->primary_color ? $account->primary_color : '#0b4d78',
|
'color' => $account->primary_color ? $account->primary_color : '#0b4d78',
|
||||||
@ -668,7 +667,7 @@ class ClientPortalController extends BaseController
|
|||||||
'gateway' => $account->getTokenGateway(),
|
'gateway' => $account->getTokenGateway(),
|
||||||
'title' => trans('texts.payment_methods'),
|
'title' => trans('texts.payment_methods'),
|
||||||
'transactionToken' => $paymentDriver->createTransactionToken(),
|
'transactionToken' => $paymentDriver->createTransactionToken(),
|
||||||
);
|
];
|
||||||
|
|
||||||
return response()->view('payments.paymentmethods', $data);
|
return response()->view('payments.paymentmethods', $data);
|
||||||
}
|
}
|
||||||
@ -730,7 +729,7 @@ class ClientPortalController extends BaseController
|
|||||||
$client = $contact->client;
|
$client = $contact->client;
|
||||||
$account = $client->account;
|
$account = $client->account;
|
||||||
|
|
||||||
$validator = Validator::make(Input::all(), array('source' => 'required'));
|
$validator = Validator::make(Input::all(), ['source' => 'required']);
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
return Redirect::to($client->account->enable_client_portal_dashboard?'/client/dashboard':'/client/payment_methods/');
|
return Redirect::to($client->account->enable_client_portal_dashboard?'/client/dashboard':'/client/payment_methods/');
|
||||||
}
|
}
|
||||||
@ -768,7 +767,7 @@ class ClientPortalController extends BaseController
|
|||||||
|
|
||||||
$client = $contact->client;
|
$client = $contact->client;
|
||||||
|
|
||||||
$validator = Validator::make(Input::all(), array('public_id' => 'required'));
|
$validator = Validator::make(Input::all(), ['public_id' => 'required']);
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
return Redirect::to('client/invoices/recurring');
|
return Redirect::to('client/invoices/recurring');
|
||||||
|
@ -4,8 +4,10 @@ use Illuminate\Foundation\Bus\DispatchesJobs;
|
|||||||
use Illuminate\Routing\Controller as BaseController;
|
use Illuminate\Routing\Controller as BaseController;
|
||||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||||
|
|
||||||
abstract class Controller extends BaseController {
|
/**
|
||||||
|
* Class Controller
|
||||||
use DispatchesJobs, ValidatesRequests;
|
*/
|
||||||
|
abstract class Controller extends BaseController
|
||||||
|
{
|
||||||
|
use DispatchesJobs, ValidatesRequests;
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
<?php namespace App\Http\Controllers;
|
<?php namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Datatable;
|
|
||||||
use Input;
|
use Input;
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use Session;
|
use Session;
|
||||||
use URL;
|
use URL;
|
||||||
use Utils;
|
use Utils;
|
||||||
use View;
|
use View;
|
||||||
use Validator;
|
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Services\CreditService;
|
use App\Services\CreditService;
|
||||||
use App\Ninja\Repositories\CreditRepository;
|
use App\Ninja\Repositories\CreditRepository;
|
||||||
@ -35,7 +33,7 @@ class CreditController extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
return View::make('list', array(
|
return View::make('list', [
|
||||||
'entityType' => ENTITY_CREDIT,
|
'entityType' => ENTITY_CREDIT,
|
||||||
'title' => trans('texts.credits'),
|
'title' => trans('texts.credits'),
|
||||||
'sortCol' => '4',
|
'sortCol' => '4',
|
||||||
@ -48,7 +46,7 @@ class CreditController extends BaseController
|
|||||||
'private_notes',
|
'private_notes',
|
||||||
''
|
''
|
||||||
]),
|
]),
|
||||||
));
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDatatable($clientPublicId = null)
|
public function getDatatable($clientPublicId = null)
|
||||||
@ -58,14 +56,14 @@ class CreditController extends BaseController
|
|||||||
|
|
||||||
public function create(CreditRequest $request)
|
public function create(CreditRequest $request)
|
||||||
{
|
{
|
||||||
$data = array(
|
$data = [
|
||||||
'clientPublicId' => Input::old('client') ? Input::old('client') : ($request->client_id ?: 0),
|
'clientPublicId' => Input::old('client') ? Input::old('client') : ($request->client_id ?: 0),
|
||||||
'credit' => null,
|
'credit' => null,
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'url' => 'credits',
|
'url' => 'credits',
|
||||||
'title' => trans('texts.new_credit'),
|
'title' => trans('texts.new_credit'),
|
||||||
'clients' => Client::scope()->viewable()->with('contacts')->orderBy('name')->get(),
|
'clients' => Client::scope()->viewable()->with('contacts')->orderBy('name')->get(),
|
||||||
);
|
];
|
||||||
|
|
||||||
return View::make('credits.edit', $data);
|
return View::make('credits.edit', $data);
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
use Auth;
|
use Auth;
|
||||||
use DB;
|
use DB;
|
||||||
use View;
|
|
||||||
use App\Models\Activity;
|
|
||||||
|
|
||||||
class DashboardApiController extends BaseAPIController
|
class DashboardApiController extends BaseAPIController
|
||||||
{
|
{
|
||||||
|
@ -7,8 +7,14 @@ use App\Models\Activity;
|
|||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class DashboardController
|
||||||
|
*/
|
||||||
class DashboardController extends BaseController
|
class DashboardController extends BaseController
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Contracts\View\View
|
||||||
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$view_all = Auth::user()->hasPermission('view_all');
|
$view_all = Auth::user()->hasPermission('view_all');
|
||||||
|
@ -1,17 +1,30 @@
|
|||||||
<?php namespace App\Http\Controllers;
|
<?php namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Models\Document;
|
use App\Models\Document;
|
||||||
|
|
||||||
use App\Ninja\Repositories\DocumentRepository;
|
use App\Ninja\Repositories\DocumentRepository;
|
||||||
use App\Http\Requests\DocumentRequest;
|
use App\Http\Requests\DocumentRequest;
|
||||||
use App\Http\Requests\CreateDocumentRequest;
|
use App\Http\Requests\CreateDocumentRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class DocumentAPIController
|
||||||
|
*/
|
||||||
class DocumentAPIController extends BaseAPIController
|
class DocumentAPIController extends BaseAPIController
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var DocumentRepository
|
||||||
|
*/
|
||||||
protected $documentRepo;
|
protected $documentRepo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $entityType = ENTITY_DOCUMENT;
|
protected $entityType = ENTITY_DOCUMENT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DocumentAPIController constructor.
|
||||||
|
*
|
||||||
|
* @param DocumentRepository $documentRepo
|
||||||
|
*/
|
||||||
public function __construct(DocumentRepository $documentRepo)
|
public function __construct(DocumentRepository $documentRepo)
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@ -19,6 +32,9 @@ class DocumentAPIController extends BaseAPIController
|
|||||||
$this->documentRepo = $documentRepo;
|
$this->documentRepo = $documentRepo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$documents = Document::scope();
|
$documents = Document::scope();
|
||||||
@ -27,6 +43,11 @@ class DocumentAPIController extends BaseAPIController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param DocumentRequest $request
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response|\Redirect|\Symfony\Component\HttpFoundation\StreamedResponse
|
||||||
|
*/
|
||||||
public function show(DocumentRequest $request)
|
public function show(DocumentRequest $request)
|
||||||
{
|
{
|
||||||
$document = $request->entity();
|
$document = $request->entity();
|
||||||
@ -34,6 +55,11 @@ class DocumentAPIController extends BaseAPIController
|
|||||||
return DocumentController::getDownloadResponse($document);
|
return DocumentController::getDownloadResponse($document);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param CreateDocumentRequest $request
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
public function store(CreateDocumentRequest $request)
|
public function store(CreateDocumentRequest $request)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -41,14 +67,4 @@ class DocumentAPIController extends BaseAPIController
|
|||||||
|
|
||||||
return $this->itemResponse($document);
|
return $this->itemResponse($document);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update()
|
|
||||||
{
|
|
||||||
//stub
|
|
||||||
}
|
|
||||||
|
|
||||||
public function destroy($publicId)
|
|
||||||
{
|
|
||||||
//stub
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,10 @@
|
|||||||
<?php namespace App\Http\Controllers;
|
<?php namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Datatable;
|
|
||||||
use Input;
|
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use Session;
|
|
||||||
use URL;
|
|
||||||
use Utils;
|
|
||||||
use View;
|
use View;
|
||||||
use Validator;
|
|
||||||
use Response;
|
use Response;
|
||||||
use App\Models\Document;
|
use App\Models\Document;
|
||||||
use App\Ninja\Repositories\DocumentRepository;
|
use App\Ninja\Repositories\DocumentRepository;
|
||||||
|
|
||||||
use App\Http\Requests\DocumentRequest;
|
use App\Http\Requests\DocumentRequest;
|
||||||
use App\Http\Requests\CreateDocumentRequest;
|
use App\Http\Requests\CreateDocumentRequest;
|
||||||
use App\Http\Requests\UpdateDocumentRequest;
|
use App\Http\Requests\UpdateDocumentRequest;
|
||||||
@ -64,7 +57,7 @@ class DocumentController extends BaseController
|
|||||||
$document = $request->entity();
|
$document = $request->entity();
|
||||||
|
|
||||||
if(empty($document->preview)){
|
if(empty($document->preview)){
|
||||||
return Response::view('error', array('error'=>'Preview does not exist!'), 404);
|
return Response::view('error', ['error'=>'Preview does not exist!'], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$direct_url = $document->getDirectPreviewUrl();
|
$direct_url = $document->getDirectPreviewUrl();
|
||||||
@ -88,7 +81,7 @@ class DocumentController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!$document->isPDFEmbeddable()){
|
if(!$document->isPDFEmbeddable()){
|
||||||
return Response::view('error', array('error'=>'Image does not exist!'), 404);
|
return Response::view('error', ['error'=>'Image does not exist!'], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = $document->preview?$document->getRawPreview():$document->getRaw();
|
$content = $document->preview?$document->getRawPreview():$document->getRaw();
|
||||||
|
@ -2,13 +2,7 @@
|
|||||||
|
|
||||||
use App\Models\Expense;
|
use App\Models\Expense;
|
||||||
use App\Ninja\Repositories\ExpenseRepository;
|
use App\Ninja\Repositories\ExpenseRepository;
|
||||||
use App\Ninja\Transformers\ExpenseTransformer;
|
|
||||||
use App\Services\ExpenseService;
|
use App\Services\ExpenseService;
|
||||||
use Utils;
|
|
||||||
use Response;
|
|
||||||
use Input;
|
|
||||||
use Auth;
|
|
||||||
|
|
||||||
|
|
||||||
class ExpenseApiController extends BaseAPIController
|
class ExpenseApiController extends BaseAPIController
|
||||||
{
|
{
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
<?php namespace App\Http\Controllers;
|
<?php namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Debugbar;
|
|
||||||
use DB;
|
|
||||||
use Auth;
|
use Auth;
|
||||||
use Datatable;
|
|
||||||
use Utils;
|
use Utils;
|
||||||
use View;
|
use View;
|
||||||
use URL;
|
use URL;
|
||||||
use Validator;
|
|
||||||
use Input;
|
use Input;
|
||||||
use Session;
|
use Session;
|
||||||
use Redirect;
|
use Redirect;
|
||||||
@ -17,7 +13,6 @@ use App\Models\Expense;
|
|||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Services\ExpenseService;
|
use App\Services\ExpenseService;
|
||||||
use App\Ninja\Repositories\ExpenseRepository;
|
use App\Ninja\Repositories\ExpenseRepository;
|
||||||
|
|
||||||
use App\Http\Requests\ExpenseRequest;
|
use App\Http\Requests\ExpenseRequest;
|
||||||
use App\Http\Requests\CreateExpenseRequest;
|
use App\Http\Requests\CreateExpenseRequest;
|
||||||
use App\Http\Requests\UpdateExpenseRequest;
|
use App\Http\Requests\UpdateExpenseRequest;
|
||||||
@ -44,7 +39,7 @@ class ExpenseController extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
return View::make('list', array(
|
return View::make('list', [
|
||||||
'entityType' => ENTITY_EXPENSE,
|
'entityType' => ENTITY_EXPENSE,
|
||||||
'title' => trans('texts.expenses'),
|
'title' => trans('texts.expenses'),
|
||||||
'sortCol' => '3',
|
'sortCol' => '3',
|
||||||
@ -58,7 +53,7 @@ class ExpenseController extends BaseController
|
|||||||
'status',
|
'status',
|
||||||
''
|
''
|
||||||
]),
|
]),
|
||||||
));
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDatatable($expensePublicId = null)
|
public function getDatatable($expensePublicId = null)
|
||||||
@ -79,7 +74,7 @@ class ExpenseController extends BaseController
|
|||||||
$vendor = null;
|
$vendor = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = array(
|
$data = [
|
||||||
'vendorPublicId' => Input::old('vendor') ? Input::old('vendor') : $request->vendor_id,
|
'vendorPublicId' => Input::old('vendor') ? Input::old('vendor') : $request->vendor_id,
|
||||||
'expense' => null,
|
'expense' => null,
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
@ -89,7 +84,7 @@ class ExpenseController extends BaseController
|
|||||||
'vendor' => $vendor,
|
'vendor' => $vendor,
|
||||||
'clients' => Client::scope()->with('contacts')->orderBy('name')->get(),
|
'clients' => Client::scope()->with('contacts')->orderBy('name')->get(),
|
||||||
'clientPublicId' => $request->client_id,
|
'clientPublicId' => $request->client_id,
|
||||||
);
|
];
|
||||||
|
|
||||||
$data = array_merge($data, self::getViewModel());
|
$data = array_merge($data, self::getViewModel());
|
||||||
|
|
||||||
@ -104,9 +99,9 @@ class ExpenseController extends BaseController
|
|||||||
|
|
||||||
$actions = [];
|
$actions = [];
|
||||||
if ($expense->invoice) {
|
if ($expense->invoice) {
|
||||||
$actions[] = ['url' => URL::to("invoices/{$expense->invoice->public_id}/edit"), 'label' => trans("texts.view_invoice")];
|
$actions[] = ['url' => URL::to("invoices/{$expense->invoice->public_id}/edit"), 'label' => trans('texts.view_invoice')];
|
||||||
} else {
|
} else {
|
||||||
$actions[] = ['url' => 'javascript:submitAction("invoice")', 'label' => trans("texts.invoice_expense")];
|
$actions[] = ['url' => 'javascript:submitAction("invoice")', 'label' => trans('texts.invoice_expense')];
|
||||||
}
|
}
|
||||||
|
|
||||||
$actions[] = \DropdownButton::DIVIDER;
|
$actions[] = \DropdownButton::DIVIDER;
|
||||||
@ -117,7 +112,7 @@ class ExpenseController extends BaseController
|
|||||||
$actions[] = ['url' => 'javascript:submitAction("restore")', 'label' => trans('texts.restore_expense')];
|
$actions[] = ['url' => 'javascript:submitAction("restore")', 'label' => trans('texts.restore_expense')];
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = array(
|
$data = [
|
||||||
'vendor' => null,
|
'vendor' => null,
|
||||||
'expense' => $expense,
|
'expense' => $expense,
|
||||||
'method' => 'PUT',
|
'method' => 'PUT',
|
||||||
@ -128,7 +123,7 @@ class ExpenseController extends BaseController
|
|||||||
'vendorPublicId' => $expense->vendor ? $expense->vendor->public_id : null,
|
'vendorPublicId' => $expense->vendor ? $expense->vendor->public_id : null,
|
||||||
'clients' => Client::scope()->with('contacts')->orderBy('name')->get(),
|
'clients' => Client::scope()->with('contacts')->orderBy('name')->get(),
|
||||||
'clientPublicId' => $expense->client ? $expense->client->public_id : null,
|
'clientPublicId' => $expense->client ? $expense->client->public_id : null,
|
||||||
);
|
];
|
||||||
|
|
||||||
$data = array_merge($data, self::getViewModel());
|
$data = array_merge($data, self::getViewModel());
|
||||||
|
|
||||||
|
@ -16,8 +16,16 @@ use App\Models\Payment;
|
|||||||
use App\Models\Vendor;
|
use App\Models\Vendor;
|
||||||
use App\Models\VendorContact;
|
use App\Models\VendorContact;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ExportController
|
||||||
|
*/
|
||||||
class ExportController extends BaseController
|
class ExportController extends BaseController
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @param Request $request
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\JsonResponse
|
||||||
|
*/
|
||||||
public function doExport(Request $request)
|
public function doExport(Request $request)
|
||||||
{
|
{
|
||||||
$format = $request->input('format');
|
$format = $request->input('format');
|
||||||
@ -33,6 +41,12 @@ class ExportController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $request
|
||||||
|
* @param $fileName
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\JsonResponse
|
||||||
|
*/
|
||||||
private function returnJSON($request, $fileName)
|
private function returnJSON($request, $fileName)
|
||||||
{
|
{
|
||||||
$output = fopen('php://output', 'w') or Utils::fatalError();
|
$output = fopen('php://output', 'w') or Utils::fatalError();
|
||||||
@ -62,7 +76,12 @@ class ExportController extends BaseController
|
|||||||
return response()->json($data);
|
return response()->json($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $request
|
||||||
|
* @param $fileName
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
private function returnCSV($request, $fileName)
|
private function returnCSV($request, $fileName)
|
||||||
{
|
{
|
||||||
$data = $this->getData($request);
|
$data = $this->getData($request);
|
||||||
@ -74,6 +93,12 @@ class ExportController extends BaseController
|
|||||||
})->download('csv');
|
})->download('csv');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $request
|
||||||
|
* @param $fileName
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
private function returnXLS($request, $fileName)
|
private function returnXLS($request, $fileName)
|
||||||
{
|
{
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
@ -110,6 +135,11 @@ class ExportController extends BaseController
|
|||||||
})->download('xls');
|
})->download('xls');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $request
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
private function getData($request)
|
private function getData($request)
|
||||||
{
|
{
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
@ -184,12 +214,6 @@ class ExportController extends BaseController
|
|||||||
->with('user', 'vendor.vendor_contacts')
|
->with('user', 'vendor.vendor_contacts')
|
||||||
->withTrashed()
|
->withTrashed()
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
/*
|
|
||||||
$data['expenses'] = Credit::scope()
|
|
||||||
->with('user', 'client.contacts')
|
|
||||||
->get();
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
|
@ -9,12 +9,22 @@ use Session;
|
|||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
use App\Libraries\Utils;
|
use App\Libraries\Utils;
|
||||||
use App\Ninja\Mailers\Mailer;
|
use App\Ninja\Mailers\Mailer;
|
||||||
use Symfony\Component\Security\Core\Util\StringUtils;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class HomeController
|
||||||
|
*/
|
||||||
class HomeController extends BaseController
|
class HomeController extends BaseController
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var Mailer
|
||||||
|
*/
|
||||||
protected $mailer;
|
protected $mailer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HomeController constructor.
|
||||||
|
*
|
||||||
|
* @param Mailer $mailer
|
||||||
|
*/
|
||||||
public function __construct(Mailer $mailer)
|
public function __construct(Mailer $mailer)
|
||||||
{
|
{
|
||||||
//parent::__construct();
|
//parent::__construct();
|
||||||
@ -22,6 +32,9 @@ class HomeController extends BaseController
|
|||||||
$this->mailer = $mailer;
|
$this->mailer = $mailer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
public function showIndex()
|
public function showIndex()
|
||||||
{
|
{
|
||||||
Session::reflash();
|
Session::reflash();
|
||||||
@ -35,16 +48,25 @@ class HomeController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Contracts\View\View
|
||||||
|
*/
|
||||||
public function showTerms()
|
public function showTerms()
|
||||||
{
|
{
|
||||||
return View::make('public.terms', ['hideHeader' => true]);
|
return View::make('public.terms', ['hideHeader' => true]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Contracts\View\View
|
||||||
|
*/
|
||||||
public function viewLogo()
|
public function viewLogo()
|
||||||
{
|
{
|
||||||
return View::make('public.logo');
|
return View::make('public.logo');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Contracts\View\View|\Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
public function invoiceNow()
|
public function invoiceNow()
|
||||||
{
|
{
|
||||||
if (Auth::check() && Input::get('new_company')) {
|
if (Auth::check() && Input::get('new_company')) {
|
||||||
@ -68,6 +90,11 @@ class HomeController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $userType
|
||||||
|
* @param $version
|
||||||
|
* @return \Illuminate\Http\JsonResponse
|
||||||
|
*/
|
||||||
public function newsFeed($userType, $version)
|
public function newsFeed($userType, $version)
|
||||||
{
|
{
|
||||||
$response = Utils::getNewsFeedResponse($userType);
|
$response = Utils::getNewsFeedResponse($userType);
|
||||||
@ -75,6 +102,9 @@ class HomeController extends BaseController
|
|||||||
return Response::json($response);
|
return Response::json($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function hideMessage()
|
public function hideMessage()
|
||||||
{
|
{
|
||||||
if (Auth::check() && Session::has('news_feed_id')) {
|
if (Auth::check() && Session::has('news_feed_id')) {
|
||||||
@ -91,11 +121,17 @@ class HomeController extends BaseController
|
|||||||
return 'success';
|
return 'success';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function logError()
|
public function logError()
|
||||||
{
|
{
|
||||||
return Utils::logError(Input::get('error'), 'JavaScript');
|
return Utils::logError(Input::get('error'), 'JavaScript');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
public function keepAlive()
|
public function keepAlive()
|
||||||
{
|
{
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
|
@ -7,7 +7,6 @@ use Input;
|
|||||||
use Session;
|
use Session;
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use App\Services\ImportService;
|
use App\Services\ImportService;
|
||||||
use App\Http\Controllers\BaseController;
|
|
||||||
|
|
||||||
class ImportController extends BaseController
|
class ImportController extends BaseController
|
||||||
{
|
{
|
||||||
|
@ -6,8 +6,14 @@ use Auth;
|
|||||||
use Input;
|
use Input;
|
||||||
use App\Models\Subscription;
|
use App\Models\Subscription;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class IntegrationController
|
||||||
|
*/
|
||||||
class IntegrationController extends Controller
|
class IntegrationController extends Controller
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Http\JsonResponse
|
||||||
|
*/
|
||||||
public function subscribe()
|
public function subscribe()
|
||||||
{
|
{
|
||||||
$eventId = Utils::lookupEventId(trim(Input::get('event')));
|
$eventId = Utils::lookupEventId(trim(Input::get('event')));
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<?php namespace App\Http\Controllers;
|
<?php namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Auth;
|
use Auth;
|
||||||
use Illuminate\Support\Facades\Request;
|
|
||||||
use Utils;
|
use Utils;
|
||||||
use Response;
|
use Response;
|
||||||
use Input;
|
use Input;
|
||||||
@ -10,13 +9,10 @@ use App\Models\Invoice;
|
|||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\Contact;
|
use App\Models\Contact;
|
||||||
use App\Models\Product;
|
use App\Models\Product;
|
||||||
use App\Models\Invitation;
|
|
||||||
use App\Ninja\Repositories\ClientRepository;
|
use App\Ninja\Repositories\ClientRepository;
|
||||||
use App\Ninja\Repositories\PaymentRepository;
|
use App\Ninja\Repositories\PaymentRepository;
|
||||||
use App\Ninja\Repositories\InvoiceRepository;
|
use App\Ninja\Repositories\InvoiceRepository;
|
||||||
use App\Ninja\Mailers\ContactMailer as Mailer;
|
use App\Ninja\Mailers\ContactMailer as Mailer;
|
||||||
use App\Http\Controllers\BaseAPIController;
|
|
||||||
use App\Ninja\Transformers\InvoiceTransformer;
|
|
||||||
use App\Http\Requests\InvoiceRequest;
|
use App\Http\Requests\InvoiceRequest;
|
||||||
use App\Http\Requests\CreateInvoiceAPIRequest;
|
use App\Http\Requests\CreateInvoiceAPIRequest;
|
||||||
use App\Http\Requests\UpdateInvoiceAPIRequest;
|
use App\Http\Requests\UpdateInvoiceAPIRequest;
|
||||||
|
@ -8,10 +8,7 @@ use Input;
|
|||||||
use Cache;
|
use Cache;
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use DB;
|
use DB;
|
||||||
use Event;
|
|
||||||
use URL;
|
use URL;
|
||||||
use Datatable;
|
|
||||||
use Request;
|
|
||||||
use DropdownButton;
|
use DropdownButton;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
@ -28,7 +25,6 @@ use App\Ninja\Repositories\DocumentRepository;
|
|||||||
use App\Services\InvoiceService;
|
use App\Services\InvoiceService;
|
||||||
use App\Services\PaymentService;
|
use App\Services\PaymentService;
|
||||||
use App\Services\RecurringInvoiceService;
|
use App\Services\RecurringInvoiceService;
|
||||||
|
|
||||||
use App\Http\Requests\InvoiceRequest;
|
use App\Http\Requests\InvoiceRequest;
|
||||||
use App\Http\Requests\CreateInvoiceRequest;
|
use App\Http\Requests\CreateInvoiceRequest;
|
||||||
use App\Http\Requests\UpdateInvoiceRequest;
|
use App\Http\Requests\UpdateInvoiceRequest;
|
||||||
@ -139,23 +135,23 @@ class InvoiceController extends BaseController
|
|||||||
|
|
||||||
$actions = [
|
$actions = [
|
||||||
['url' => 'javascript:onCloneClick()', 'label' => trans("texts.clone_{$entityType}")],
|
['url' => 'javascript:onCloneClick()', 'label' => trans("texts.clone_{$entityType}")],
|
||||||
['url' => URL::to("{$entityType}s/{$entityType}_history/{$invoice->public_id}"), 'label' => trans("texts.view_history")],
|
['url' => URL::to("{$entityType}s/{$entityType}_history/{$invoice->public_id}"), 'label' => trans('texts.view_history')],
|
||||||
DropdownButton::DIVIDER
|
DropdownButton::DIVIDER
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($invoice->invoice_status_id < INVOICE_STATUS_SENT && !$invoice->is_recurring) {
|
if ($invoice->invoice_status_id < INVOICE_STATUS_SENT && !$invoice->is_recurring) {
|
||||||
$actions[] = ['url' => 'javascript:onMarkClick()', 'label' => trans("texts.mark_sent")];
|
$actions[] = ['url' => 'javascript:onMarkClick()', 'label' => trans('texts.mark_sent')];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($entityType == ENTITY_QUOTE) {
|
if ($entityType == ENTITY_QUOTE) {
|
||||||
if ($invoice->quote_invoice_id) {
|
if ($invoice->quote_invoice_id) {
|
||||||
$actions[] = ['url' => URL::to("invoices/{$invoice->quote_invoice_id}/edit"), 'label' => trans("texts.view_invoice")];
|
$actions[] = ['url' => URL::to("invoices/{$invoice->quote_invoice_id}/edit"), 'label' => trans('texts.view_invoice')];
|
||||||
} else {
|
} else {
|
||||||
$actions[] = ['url' => 'javascript:onConvertClick()', 'label' => trans("texts.convert_to_invoice")];
|
$actions[] = ['url' => 'javascript:onConvertClick()', 'label' => trans('texts.convert_to_invoice')];
|
||||||
}
|
}
|
||||||
} elseif ($entityType == ENTITY_INVOICE) {
|
} elseif ($entityType == ENTITY_INVOICE) {
|
||||||
if ($invoice->quote_id) {
|
if ($invoice->quote_id) {
|
||||||
$actions[] = ['url' => URL::to("quotes/{$invoice->quote_id}/edit"), 'label' => trans("texts.view_quote")];
|
$actions[] = ['url' => URL::to("quotes/{$invoice->quote_id}/edit"), 'label' => trans('texts.view_quote')];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$invoice->is_recurring && $invoice->balance > 0) {
|
if (!$invoice->is_recurring && $invoice->balance > 0) {
|
||||||
@ -163,7 +159,7 @@ class InvoiceController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($invoice->payments as $payment) {
|
foreach ($invoice->payments as $payment) {
|
||||||
$label = trans("texts.view_payment");
|
$label = trans('texts.view_payment');
|
||||||
if (count($invoice->payments) > 1) {
|
if (count($invoice->payments) > 1) {
|
||||||
$label .= ' - ' . $account->formatMoney($payment->amount, $invoice->client);
|
$label .= ' - ' . $account->formatMoney($payment->amount, $invoice->client);
|
||||||
}
|
}
|
||||||
@ -184,7 +180,7 @@ class InvoiceController extends BaseController
|
|||||||
$clients = $clients->where('clients.user_id', '=', Auth::user()->id);
|
$clients = $clients->where('clients.user_id', '=', Auth::user()->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = array(
|
$data = [
|
||||||
'clients' => $clients->get(),
|
'clients' => $clients->get(),
|
||||||
'entityType' => $entityType,
|
'entityType' => $entityType,
|
||||||
'showBreadcrumbs' => $clone,
|
'showBreadcrumbs' => $clone,
|
||||||
@ -196,7 +192,7 @@ class InvoiceController extends BaseController
|
|||||||
'client' => $invoice->client,
|
'client' => $invoice->client,
|
||||||
'isRecurring' => $invoice->is_recurring,
|
'isRecurring' => $invoice->is_recurring,
|
||||||
'actions' => $actions,
|
'actions' => $actions,
|
||||||
'lastSent' => $lastSent);
|
'lastSent' => $lastSent];
|
||||||
$data = array_merge($data, self::getViewModel($invoice));
|
$data = array_merge($data, self::getViewModel($invoice));
|
||||||
|
|
||||||
if ($invoice->isSent() && $invoice->getAutoBillEnabled() && !$invoice->isPaid()) {
|
if ($invoice->isSent() && $invoice->getAutoBillEnabled() && !$invoice->isPaid()) {
|
||||||
@ -280,7 +276,7 @@ class InvoiceController extends BaseController
|
|||||||
{
|
{
|
||||||
$recurringHelp = '';
|
$recurringHelp = '';
|
||||||
foreach (preg_split("/((\r?\n)|(\r\n?))/", trans('texts.recurring_help')) as $line) {
|
foreach (preg_split("/((\r?\n)|(\r\n?))/", trans('texts.recurring_help')) as $line) {
|
||||||
$parts = explode("=>", $line);
|
$parts = explode('=>', $line);
|
||||||
if (count($parts) > 1) {
|
if (count($parts) > 1) {
|
||||||
$line = $parts[0].' => '.Utils::processVariables($parts[0]);
|
$line = $parts[0].' => '.Utils::processVariables($parts[0]);
|
||||||
$recurringHelp .= '<li>'.strip_tags($line).'</li>';
|
$recurringHelp .= '<li>'.strip_tags($line).'</li>';
|
||||||
@ -291,7 +287,7 @@ class InvoiceController extends BaseController
|
|||||||
|
|
||||||
$recurringDueDateHelp = '';
|
$recurringDueDateHelp = '';
|
||||||
foreach (preg_split("/((\r?\n)|(\r\n?))/", trans('texts.recurring_due_date_help')) as $line) {
|
foreach (preg_split("/((\r?\n)|(\r\n?))/", trans('texts.recurring_due_date_help')) as $line) {
|
||||||
$parts = explode("=>", $line);
|
$parts = explode('=>', $line);
|
||||||
if (count($parts) > 1) {
|
if (count($parts) > 1) {
|
||||||
$line = $parts[0].' => '.Utils::processVariables($parts[0]);
|
$line = $parts[0].' => '.Utils::processVariables($parts[0]);
|
||||||
$recurringDueDateHelp .= '<li>'.strip_tags($line).'</li>';
|
$recurringDueDateHelp .= '<li>'.strip_tags($line).'</li>';
|
||||||
@ -301,24 +297,24 @@ class InvoiceController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create due date options
|
// Create due date options
|
||||||
$recurringDueDates = array(
|
$recurringDueDates = [
|
||||||
trans('texts.use_client_terms') => array('value' => '', 'class' => 'monthly weekly'),
|
trans('texts.use_client_terms') => ['value' => '', 'class' => 'monthly weekly'],
|
||||||
);
|
];
|
||||||
|
|
||||||
$ends = array('th','st','nd','rd','th','th','th','th','th','th');
|
$ends = ['th','st','nd','rd','th','th','th','th','th','th'];
|
||||||
for($i = 1; $i < 31; $i++){
|
for($i = 1; $i < 31; $i++){
|
||||||
if ($i >= 11 && $i <= 13) $ordinal = $i. 'th';
|
if ($i >= 11 && $i <= 13) $ordinal = $i. 'th';
|
||||||
else $ordinal = $i . $ends[$i % 10];
|
else $ordinal = $i . $ends[$i % 10];
|
||||||
|
|
||||||
$dayStr = str_pad($i, 2, '0', STR_PAD_LEFT);
|
$dayStr = str_pad($i, 2, '0', STR_PAD_LEFT);
|
||||||
$str = trans('texts.day_of_month', array('ordinal'=>$ordinal));
|
$str = trans('texts.day_of_month', ['ordinal'=>$ordinal]);
|
||||||
|
|
||||||
$recurringDueDates[$str] = array('value' => "1998-01-$dayStr", 'data-num' => $i, 'class' => 'monthly');
|
$recurringDueDates[$str] = ['value' => "1998-01-$dayStr", 'data-num' => $i, 'class' => 'monthly'];
|
||||||
}
|
}
|
||||||
$recurringDueDates[trans('texts.last_day_of_month')] = array('value' => "1998-01-31", 'data-num' => 31, 'class' => 'monthly');
|
$recurringDueDates[trans('texts.last_day_of_month')] = ['value' => '1998-01-31', 'data-num' => 31, 'class' => 'monthly'];
|
||||||
|
|
||||||
|
|
||||||
$daysOfWeek = array(
|
$daysOfWeek = [
|
||||||
trans('texts.sunday'),
|
trans('texts.sunday'),
|
||||||
trans('texts.monday'),
|
trans('texts.monday'),
|
||||||
trans('texts.tuesday'),
|
trans('texts.tuesday'),
|
||||||
@ -326,14 +322,14 @@ class InvoiceController extends BaseController
|
|||||||
trans('texts.thursday'),
|
trans('texts.thursday'),
|
||||||
trans('texts.friday'),
|
trans('texts.friday'),
|
||||||
trans('texts.saturday'),
|
trans('texts.saturday'),
|
||||||
);
|
];
|
||||||
foreach(array('1st','2nd','3rd','4th') as $i=>$ordinal){
|
foreach(['1st','2nd','3rd','4th'] as $i=>$ordinal){
|
||||||
foreach($daysOfWeek as $j=>$dayOfWeek){
|
foreach($daysOfWeek as $j=>$dayOfWeek){
|
||||||
$str = trans('texts.day_of_week_after', array('ordinal' => $ordinal, 'day' => $dayOfWeek));
|
$str = trans('texts.day_of_week_after', ['ordinal' => $ordinal, 'day' => $dayOfWeek]);
|
||||||
|
|
||||||
$day = $i * 7 + $j + 1;
|
$day = $i * 7 + $j + 1;
|
||||||
$dayStr = str_pad($day, 2, '0', STR_PAD_LEFT);
|
$dayStr = str_pad($day, 2, '0', STR_PAD_LEFT);
|
||||||
$recurringDueDates[$str] = array('value' => "1998-02-$dayStr", 'data-num' => $day, 'class' => 'weekly');
|
$recurringDueDates[$str] = ['value' => "1998-02-$dayStr", 'data-num' => $day, 'class' => 'weekly'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -375,7 +371,7 @@ class InvoiceController extends BaseController
|
|||||||
'industries' => Cache::get('industries'),
|
'industries' => Cache::get('industries'),
|
||||||
'invoiceDesigns' => InvoiceDesign::getDesigns(),
|
'invoiceDesigns' => InvoiceDesign::getDesigns(),
|
||||||
'invoiceFonts' => Cache::get('fonts'),
|
'invoiceFonts' => Cache::get('fonts'),
|
||||||
'frequencies' => array(
|
'frequencies' => [
|
||||||
1 => 'Weekly',
|
1 => 'Weekly',
|
||||||
2 => 'Two weeks',
|
2 => 'Two weeks',
|
||||||
3 => 'Four weeks',
|
3 => 'Four weeks',
|
||||||
@ -383,7 +379,7 @@ class InvoiceController extends BaseController
|
|||||||
5 => 'Three months',
|
5 => 'Three months',
|
||||||
6 => 'Six months',
|
6 => 'Six months',
|
||||||
7 => 'Annually',
|
7 => 'Annually',
|
||||||
),
|
],
|
||||||
'recurringDueDates' => $recurringDueDates,
|
'recurringDueDates' => $recurringDueDates,
|
||||||
'recurringHelp' => $recurringHelp,
|
'recurringHelp' => $recurringHelp,
|
||||||
'recurringDueDateHelp' => $recurringDueDateHelp,
|
'recurringDueDateHelp' => $recurringDueDateHelp,
|
||||||
|
@ -17,13 +17,35 @@ use App\Ninja\Mailers\ContactMailer;
|
|||||||
|
|
||||||
class NinjaController extends BaseController
|
class NinjaController extends BaseController
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var AccountRepository
|
||||||
|
*/
|
||||||
|
protected $accountRepo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ContactMailer
|
||||||
|
*/
|
||||||
|
protected $contactMailer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NinjaController constructor.
|
||||||
|
*
|
||||||
|
* @param AccountRepository $accountRepo
|
||||||
|
* @param ContactMailer $contactMailer
|
||||||
|
*/
|
||||||
public function __construct(AccountRepository $accountRepo, ContactMailer $contactMailer)
|
public function __construct(AccountRepository $accountRepo, ContactMailer $contactMailer)
|
||||||
{
|
{
|
||||||
$this->accountRepo = $accountRepo;
|
$this->accountRepo = $accountRepo;
|
||||||
$this->contactMailer = $contactMailer;
|
$this->contactMailer = $contactMailer;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getLicensePaymentDetails($input, $affiliate)
|
/**
|
||||||
|
* @param array $input
|
||||||
|
* @param Affiliate $affiliate
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function getLicensePaymentDetails(array $input, Affiliate $affiliate)
|
||||||
{
|
{
|
||||||
$country = Country::find($input['country_id']);
|
$country = Country::find($input['country_id']);
|
||||||
|
|
||||||
@ -60,6 +82,9 @@ class NinjaController extends BaseController
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return $this|\Illuminate\Contracts\View\View
|
||||||
|
*/
|
||||||
public function show_license_payment()
|
public function show_license_payment()
|
||||||
{
|
{
|
||||||
if (Input::has('return_url')) {
|
if (Input::has('return_url')) {
|
||||||
@ -116,11 +141,14 @@ class NinjaController extends BaseController
|
|||||||
return View::make('payments.stripe.credit_card', $data);
|
return View::make('payments.stripe.credit_card', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Contracts\View\View
|
||||||
|
*/
|
||||||
public function do_license_payment()
|
public function do_license_payment()
|
||||||
{
|
{
|
||||||
$testMode = Session::get('test_mode') === 'true';
|
$testMode = Session::get('test_mode') === 'true';
|
||||||
|
|
||||||
$rules = array(
|
$rules = [
|
||||||
'first_name' => 'required',
|
'first_name' => 'required',
|
||||||
'last_name' => 'required',
|
'last_name' => 'required',
|
||||||
'email' => 'required',
|
'email' => 'required',
|
||||||
@ -133,7 +161,7 @@ class NinjaController extends BaseController
|
|||||||
'state' => 'required',
|
'state' => 'required',
|
||||||
'postal_code' => 'required',
|
'postal_code' => 'required',
|
||||||
'country_id' => 'required',
|
'country_id' => 'required',
|
||||||
);
|
];
|
||||||
|
|
||||||
$validator = Validator::make(Input::all(), $rules);
|
$validator = Validator::make(Input::all(), $rules);
|
||||||
|
|
||||||
@ -192,7 +220,7 @@ class NinjaController extends BaseController
|
|||||||
|
|
||||||
if (Session::has('return_url')) {
|
if (Session::has('return_url')) {
|
||||||
$data['redirectTo'] = Session::get('return_url')."?license_key={$license->license_key}&product_id=".Session::get('product_id');
|
$data['redirectTo'] = Session::get('return_url')."?license_key={$license->license_key}&product_id=".Session::get('product_id');
|
||||||
$data['message'] = "Redirecting to " . Session::get('return_url');
|
$data['message'] = 'Redirecting to ' . Session::get('return_url');
|
||||||
}
|
}
|
||||||
|
|
||||||
return View::make('public.license', $data);
|
return View::make('public.license', $data);
|
||||||
@ -202,6 +230,9 @@ class NinjaController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function claim_license()
|
public function claim_license()
|
||||||
{
|
{
|
||||||
$licenseKey = Input::get('license_key');
|
$licenseKey = Input::get('license_key');
|
||||||
|
@ -2,11 +2,8 @@
|
|||||||
|
|
||||||
use Session;
|
use Session;
|
||||||
use Input;
|
use Input;
|
||||||
use Request;
|
|
||||||
use Utils;
|
use Utils;
|
||||||
use View;
|
use View;
|
||||||
use Validator;
|
|
||||||
use Cache;
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use App\Models\Invitation;
|
use App\Models\Invitation;
|
||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
@ -16,14 +13,39 @@ use App\Services\PaymentService;
|
|||||||
use App\Ninja\Mailers\UserMailer;
|
use App\Ninja\Mailers\UserMailer;
|
||||||
use App\Http\Requests\CreateOnlinePaymentRequest;
|
use App\Http\Requests\CreateOnlinePaymentRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class OnlinePaymentController
|
||||||
|
*/
|
||||||
class OnlinePaymentController extends BaseController
|
class OnlinePaymentController extends BaseController
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var PaymentService
|
||||||
|
*/
|
||||||
|
protected $paymentService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var UserMailer
|
||||||
|
*/
|
||||||
|
protected $userMailer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OnlinePaymentController constructor.
|
||||||
|
*
|
||||||
|
* @param PaymentService $paymentService
|
||||||
|
* @param UserMailer $userMailer
|
||||||
|
*/
|
||||||
public function __construct(PaymentService $paymentService, UserMailer $userMailer)
|
public function __construct(PaymentService $paymentService, UserMailer $userMailer)
|
||||||
{
|
{
|
||||||
$this->paymentService = $paymentService;
|
$this->paymentService = $paymentService;
|
||||||
$this->userMailer = $userMailer;
|
$this->userMailer = $userMailer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $invitationKey
|
||||||
|
* @param bool $gatewayType
|
||||||
|
* @param bool $sourceId
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
public function showPayment($invitationKey, $gatewayType = false, $sourceId = false)
|
public function showPayment($invitationKey, $gatewayType = false, $sourceId = false)
|
||||||
{
|
{
|
||||||
$invitation = Invitation::with('invoice.invoice_items', 'invoice.client.currency', 'invoice.client.account.account_gateways.gateway')
|
$invitation = Invitation::with('invoice.invoice_items', 'invoice.client.currency', 'invoice.client.account.account_gateways.gateway')
|
||||||
@ -42,6 +64,10 @@ class OnlinePaymentController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param CreateOnlinePaymentRequest $request
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
public function doPayment(CreateOnlinePaymentRequest $request)
|
public function doPayment(CreateOnlinePaymentRequest $request)
|
||||||
{
|
{
|
||||||
$invitation = $request->invitation;
|
$invitation = $request->invitation;
|
||||||
@ -62,6 +88,11 @@ class OnlinePaymentController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $invitationKey
|
||||||
|
* @param bool $gatewayType
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
public function offsitePayment($invitationKey = false, $gatewayType = false)
|
public function offsitePayment($invitationKey = false, $gatewayType = false)
|
||||||
{
|
{
|
||||||
$invitationKey = $invitationKey ?: Session::get('invitation_key');
|
$invitationKey = $invitationKey ?: Session::get('invitation_key');
|
||||||
@ -84,6 +115,12 @@ class OnlinePaymentController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $paymentDriver
|
||||||
|
* @param $exception
|
||||||
|
* @param bool $showPayment
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
private function error($paymentDriver, $exception, $showPayment = false)
|
private function error($paymentDriver, $exception, $showPayment = false)
|
||||||
{
|
{
|
||||||
if (is_string($exception)) {
|
if (is_string($exception)) {
|
||||||
@ -104,6 +141,10 @@ class OnlinePaymentController extends BaseController
|
|||||||
return redirect()->to($route . $paymentDriver->invitation->invitation_key);
|
return redirect()->to($route . $paymentDriver->invitation->invitation_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $routingNumber
|
||||||
|
* @return \Illuminate\Http\JsonResponse
|
||||||
|
*/
|
||||||
public function getBankInfo($routingNumber) {
|
public function getBankInfo($routingNumber) {
|
||||||
if (strlen($routingNumber) != 9 || !preg_match('/\d{9}/', $routingNumber)) {
|
if (strlen($routingNumber) != 9 || !preg_match('/\d{9}/', $routingNumber)) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
@ -126,6 +167,11 @@ class OnlinePaymentController extends BaseController
|
|||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $accountKey
|
||||||
|
* @param $gatewayId
|
||||||
|
* @return \Illuminate\Http\JsonResponse
|
||||||
|
*/
|
||||||
public function handlePaymentWebhook($accountKey, $gatewayId)
|
public function handlePaymentWebhook($accountKey, $gatewayId)
|
||||||
{
|
{
|
||||||
$gatewayId = intval($gatewayId);
|
$gatewayId = intval($gatewayId);
|
||||||
|
@ -1,17 +1,11 @@
|
|||||||
<?php namespace App\Http\Controllers;
|
<?php namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Ninja\Mailers\ContactMailer;
|
use App\Ninja\Mailers\ContactMailer;
|
||||||
use Auth;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Input;
|
use Input;
|
||||||
use Utils;
|
|
||||||
use Response;
|
use Response;
|
||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Ninja\Repositories\PaymentRepository;
|
use App\Ninja\Repositories\PaymentRepository;
|
||||||
use App\Http\Controllers\BaseAPIController;
|
|
||||||
use App\Ninja\Transformers\PaymentTransformer;
|
|
||||||
use App\Ninja\Transformers\InvoiceTransformer;
|
|
||||||
use App\Http\Requests\UpdatePaymentRequest;
|
use App\Http\Requests\UpdatePaymentRequest;
|
||||||
use App\Http\Requests\CreatePaymentAPIRequest;
|
use App\Http\Requests\CreatePaymentAPIRequest;
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ use Input;
|
|||||||
use Session;
|
use Session;
|
||||||
use Utils;
|
use Utils;
|
||||||
use View;
|
use View;
|
||||||
use Omnipay;
|
|
||||||
use Cache;
|
use Cache;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
@ -17,18 +16,50 @@ use App\Http\Requests\UpdatePaymentRequest;
|
|||||||
|
|
||||||
class PaymentController extends BaseController
|
class PaymentController extends BaseController
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $entityType = ENTITY_PAYMENT;
|
protected $entityType = ENTITY_PAYMENT;
|
||||||
|
|
||||||
public function __construct(PaymentRepository $paymentRepo, ContactMailer $contactMailer, PaymentService $paymentService)
|
/**
|
||||||
|
* @var PaymentRepository
|
||||||
|
*/
|
||||||
|
protected $paymentRepo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ContactMailer
|
||||||
|
*/
|
||||||
|
protected $contactMailer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var PaymentService
|
||||||
|
*/
|
||||||
|
protected $paymentService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PaymentController constructor.
|
||||||
|
*
|
||||||
|
* @param PaymentRepository $paymentRepo
|
||||||
|
* @param ContactMailer $contactMailer
|
||||||
|
* @param PaymentService $paymentService
|
||||||
|
*/
|
||||||
|
public function __construct(
|
||||||
|
PaymentRepository $paymentRepo,
|
||||||
|
ContactMailer $contactMailer,
|
||||||
|
PaymentService $paymentService
|
||||||
|
)
|
||||||
{
|
{
|
||||||
$this->paymentRepo = $paymentRepo;
|
$this->paymentRepo = $paymentRepo;
|
||||||
$this->contactMailer = $contactMailer;
|
$this->contactMailer = $contactMailer;
|
||||||
$this->paymentService = $paymentService;
|
$this->paymentService = $paymentService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Contracts\View\View
|
||||||
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
return View::make('list', array(
|
return View::make('list', [
|
||||||
'entityType' => ENTITY_PAYMENT,
|
'entityType' => ENTITY_PAYMENT,
|
||||||
'title' => trans('texts.payments'),
|
'title' => trans('texts.payments'),
|
||||||
'sortCol' => '7',
|
'sortCol' => '7',
|
||||||
@ -44,14 +75,22 @@ class PaymentController extends BaseController
|
|||||||
'status',
|
'status',
|
||||||
''
|
''
|
||||||
]),
|
]),
|
||||||
));
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param null $clientPublicId
|
||||||
|
* @return \Illuminate\Http\JsonResponse
|
||||||
|
*/
|
||||||
public function getDatatable($clientPublicId = null)
|
public function getDatatable($clientPublicId = null)
|
||||||
{
|
{
|
||||||
return $this->paymentService->getDatatable($clientPublicId, Input::get('sSearch'));
|
return $this->paymentService->getDatatable($clientPublicId, Input::get('sSearch'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param PaymentRequest $request
|
||||||
|
* @return \Illuminate\Contracts\View\View
|
||||||
|
*/
|
||||||
public function create(PaymentRequest $request)
|
public function create(PaymentRequest $request)
|
||||||
{
|
{
|
||||||
$invoices = Invoice::scope()
|
$invoices = Invoice::scope()
|
||||||
@ -62,29 +101,33 @@ class PaymentController extends BaseController
|
|||||||
->with('client', 'invoice_status')
|
->with('client', 'invoice_status')
|
||||||
->orderBy('invoice_number')->get();
|
->orderBy('invoice_number')->get();
|
||||||
|
|
||||||
$data = array(
|
$data = [
|
||||||
'clientPublicId' => Input::old('client') ? Input::old('client') : ($request->client_id ?: 0),
|
'clientPublicId' => Input::old('client') ? Input::old('client') : ($request->client_id ?: 0),
|
||||||
'invoicePublicId' => Input::old('invoice') ? Input::old('invoice') : ($request->invoice_id ?: 0),
|
'invoicePublicId' => Input::old('invoice') ? Input::old('invoice') : ($request->invoice_id ?: 0),
|
||||||
'invoice' => null,
|
'invoice' => null,
|
||||||
'invoices' => $invoices,
|
'invoices' => $invoices,
|
||||||
'payment' => null,
|
'payment' => null,
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'url' => "payments",
|
'url' => 'payments',
|
||||||
'title' => trans('texts.new_payment'),
|
'title' => trans('texts.new_payment'),
|
||||||
'paymentTypes' => Cache::get('paymentTypes'),
|
'paymentTypes' => Cache::get('paymentTypes'),
|
||||||
'paymentTypeId' => Input::get('paymentTypeId'),
|
'paymentTypeId' => Input::get('paymentTypeId'),
|
||||||
'clients' => Client::scope()->viewable()->with('contacts')->orderBy('name')->get(), );
|
'clients' => Client::scope()->viewable()->with('contacts')->orderBy('name')->get(), ];
|
||||||
|
|
||||||
return View::make('payments.edit', $data);
|
return View::make('payments.edit', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param PaymentRequest $request
|
||||||
|
* @return \Illuminate\Contracts\View\View
|
||||||
|
*/
|
||||||
public function edit(PaymentRequest $request)
|
public function edit(PaymentRequest $request)
|
||||||
{
|
{
|
||||||
$payment = $request->entity();
|
$payment = $request->entity();
|
||||||
|
|
||||||
$payment->payment_date = Utils::fromSqlDate($payment->payment_date);
|
$payment->payment_date = Utils::fromSqlDate($payment->payment_date);
|
||||||
|
|
||||||
$data = array(
|
$data = [
|
||||||
'client' => null,
|
'client' => null,
|
||||||
'invoice' => null,
|
'invoice' => null,
|
||||||
'invoices' => Invoice::scope()->invoiceType(INVOICE_TYPE_STANDARD)->where('is_recurring', '=', false)
|
'invoices' => Invoice::scope()->invoiceType(INVOICE_TYPE_STANDARD)->where('is_recurring', '=', false)
|
||||||
@ -94,11 +137,15 @@ class PaymentController extends BaseController
|
|||||||
'url' => 'payments/'.$payment->public_id,
|
'url' => 'payments/'.$payment->public_id,
|
||||||
'title' => trans('texts.edit_payment'),
|
'title' => trans('texts.edit_payment'),
|
||||||
'paymentTypes' => Cache::get('paymentTypes'),
|
'paymentTypes' => Cache::get('paymentTypes'),
|
||||||
'clients' => Client::scope()->with('contacts')->orderBy('name')->get(), );
|
'clients' => Client::scope()->with('contacts')->orderBy('name')->get(), ];
|
||||||
|
|
||||||
return View::make('payments.edit', $data);
|
return View::make('payments.edit', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param CreatePaymentRequest $request
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
public function store(CreatePaymentRequest $request)
|
public function store(CreatePaymentRequest $request)
|
||||||
{
|
{
|
||||||
$input = $request->input();
|
$input = $request->input();
|
||||||
@ -117,6 +164,10 @@ class PaymentController extends BaseController
|
|||||||
return redirect()->to($payment->client->getRoute());
|
return redirect()->to($payment->client->getRoute());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param UpdatePaymentRequest $request
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
public function update(UpdatePaymentRequest $request)
|
public function update(UpdatePaymentRequest $request)
|
||||||
{
|
{
|
||||||
$payment = $this->paymentRepo->save($request->input(), $request->entity());
|
$payment = $this->paymentRepo->save($request->input(), $request->entity());
|
||||||
@ -126,12 +177,15 @@ class PaymentController extends BaseController
|
|||||||
return redirect()->to($payment->getRoute());
|
return redirect()->to($payment->getRoute());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
public function bulk()
|
public function bulk()
|
||||||
{
|
{
|
||||||
$action = Input::get('action');
|
$action = Input::get('action');
|
||||||
$amount = Input::get('amount');
|
$amount = Input::get('amount');
|
||||||
$ids = Input::get('public_id') ? Input::get('public_id') : Input::get('ids');
|
$ids = Input::get('public_id') ? Input::get('public_id') : Input::get('ids');
|
||||||
$count = $this->paymentService->bulk($ids, $action, array('amount'=>$amount));
|
$count = $this->paymentService->bulk($ids, $action, ['amount'=>$amount]);
|
||||||
|
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
$message = Utils::pluralize($action=='refund'?'refunded_payment':$action.'d_payment', $count);
|
$message = Utils::pluralize($action=='refund'?'refunded_payment':$action.'d_payment', $count);
|
||||||
@ -140,5 +194,4 @@ class PaymentController extends BaseController
|
|||||||
|
|
||||||
return redirect()->to('payments');
|
return redirect()->to('payments');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,25 @@
|
|||||||
<?php namespace App\Http\Controllers;
|
<?php namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
use Str;
|
|
||||||
use DB;
|
|
||||||
use Datatable;
|
|
||||||
use Utils;
|
use Utils;
|
||||||
use URL;
|
use URL;
|
||||||
use View;
|
use View;
|
||||||
use Input;
|
use Input;
|
||||||
use Session;
|
use Session;
|
||||||
use Redirect;
|
use Redirect;
|
||||||
|
|
||||||
use App\Models\PaymentTerm;
|
use App\Models\PaymentTerm;
|
||||||
use App\Ninja\Repositories\VendorRepository;
|
|
||||||
use App\Services\PaymentService;
|
|
||||||
use App\Services\PaymentTermService;
|
use App\Services\PaymentTermService;
|
||||||
|
|
||||||
class PaymentTermController extends BaseController
|
class PaymentTermController extends BaseController
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var PaymentTermService
|
||||||
|
*/
|
||||||
protected $paymentTermService;
|
protected $paymentTermService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PaymentTermController constructor.
|
||||||
|
* @param PaymentTermService $paymentTermService
|
||||||
|
*/
|
||||||
public function __construct(PaymentTermService $paymentTermService)
|
public function __construct(PaymentTermService $paymentTermService)
|
||||||
{
|
{
|
||||||
//parent::__construct();
|
//parent::__construct();
|
||||||
@ -27,16 +27,26 @@ class PaymentTermController extends BaseController
|
|||||||
$this->paymentTermService = $paymentTermService;
|
$this->paymentTermService = $paymentTermService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
return Redirect::to('settings/' . ACCOUNT_PAYMENT_TERMS);
|
return Redirect::to('settings/' . ACCOUNT_PAYMENT_TERMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Http\JsonResponse
|
||||||
|
*/
|
||||||
public function getDatatable()
|
public function getDatatable()
|
||||||
{
|
{
|
||||||
return $this->paymentTermService->getDatatable();
|
return $this->paymentTermService->getDatatable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $publicId
|
||||||
|
* @return \Illuminate\Contracts\View\View
|
||||||
|
*/
|
||||||
public function edit($publicId)
|
public function edit($publicId)
|
||||||
{
|
{
|
||||||
$data = [
|
$data = [
|
||||||
@ -49,6 +59,9 @@ class PaymentTermController extends BaseController
|
|||||||
return View::make('accounts.payment_term', $data);
|
return View::make('accounts.payment_term', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Contracts\View\View
|
||||||
|
*/
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
$data = [
|
$data = [
|
||||||
@ -61,16 +74,27 @@ class PaymentTermController extends BaseController
|
|||||||
return View::make('accounts.payment_term', $data);
|
return View::make('accounts.payment_term', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
public function store()
|
public function store()
|
||||||
{
|
{
|
||||||
return $this->save();
|
return $this->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $publicId
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
public function update($publicId)
|
public function update($publicId)
|
||||||
{
|
{
|
||||||
return $this->save($publicId);
|
return $this->save($publicId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $publicId
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
private function save($publicId = false)
|
private function save($publicId = false)
|
||||||
{
|
{
|
||||||
if ($publicId) {
|
if ($publicId) {
|
||||||
@ -89,6 +113,9 @@ class PaymentTermController extends BaseController
|
|||||||
return Redirect::to('settings/' . ACCOUNT_PAYMENT_TERMS);
|
return Redirect::to('settings/' . ACCOUNT_PAYMENT_TERMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
public function bulk()
|
public function bulk()
|
||||||
{
|
{
|
||||||
$action = Input::get('bulk_action');
|
$action = Input::get('bulk_action');
|
||||||
|
@ -5,12 +5,26 @@ use App\Ninja\Repositories\ProductRepository;
|
|||||||
use App\Http\Requests\CreateProductRequest;
|
use App\Http\Requests\CreateProductRequest;
|
||||||
use App\Http\Requests\UpdateProductRequest;
|
use App\Http\Requests\UpdateProductRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ProductApiController
|
||||||
|
*/
|
||||||
class ProductApiController extends BaseAPIController
|
class ProductApiController extends BaseAPIController
|
||||||
{
|
{
|
||||||
protected $productRepo;
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $entityType = ENTITY_PRODUCT;
|
protected $entityType = ENTITY_PRODUCT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ProductRepository
|
||||||
|
*/
|
||||||
|
protected $productRepo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ProductApiController constructor.
|
||||||
|
*
|
||||||
|
* @param ProductRepository $productRepo
|
||||||
|
*/
|
||||||
public function __construct(ProductRepository $productRepo)
|
public function __construct(ProductRepository $productRepo)
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@ -18,6 +32,9 @@ class ProductApiController extends BaseAPIController
|
|||||||
$this->productRepo = $productRepo;
|
$this->productRepo = $productRepo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$products = Product::scope()
|
$products = Product::scope()
|
||||||
@ -27,6 +44,10 @@ class ProductApiController extends BaseAPIController
|
|||||||
return $this->listResponse($products);
|
return $this->listResponse($products);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param CreateProductRequest $request
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
public function store(CreateProductRequest $request)
|
public function store(CreateProductRequest $request)
|
||||||
{
|
{
|
||||||
$product = $this->productRepo->save($request->input());
|
$product = $this->productRepo->save($request->input());
|
||||||
@ -34,6 +55,11 @@ class ProductApiController extends BaseAPIController
|
|||||||
return $this->itemResponse($product);
|
return $this->itemResponse($product);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param UpdateProductRequest $request
|
||||||
|
* @param $publicId
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
public function update(UpdateProductRequest $request, $publicId)
|
public function update(UpdateProductRequest $request, $publicId)
|
||||||
{
|
{
|
||||||
if ($request->action) {
|
if ($request->action) {
|
||||||
@ -46,9 +72,4 @@ class ProductApiController extends BaseAPIController
|
|||||||
|
|
||||||
return $this->itemResponse($product);
|
return $this->itemResponse($product);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy($publicId)
|
|
||||||
{
|
|
||||||
//stub
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,30 @@
|
|||||||
<?php namespace App\Http\Controllers;
|
<?php namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Auth;
|
use Auth;
|
||||||
use Str;
|
|
||||||
use DB;
|
|
||||||
use Datatable;
|
|
||||||
use Utils;
|
|
||||||
use URL;
|
use URL;
|
||||||
use View;
|
use View;
|
||||||
use Input;
|
use Input;
|
||||||
use Session;
|
use Session;
|
||||||
use Redirect;
|
use Redirect;
|
||||||
|
|
||||||
use App\Models\Product;
|
use App\Models\Product;
|
||||||
use App\Models\TaxRate;
|
use App\Models\TaxRate;
|
||||||
use App\Services\ProductService;
|
use App\Services\ProductService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ProductController
|
||||||
|
*/
|
||||||
class ProductController extends BaseController
|
class ProductController extends BaseController
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var ProductService
|
||||||
|
*/
|
||||||
protected $productService;
|
protected $productService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ProductController constructor.
|
||||||
|
*
|
||||||
|
* @param ProductService $productService
|
||||||
|
*/
|
||||||
public function __construct(ProductService $productService)
|
public function __construct(ProductService $productService)
|
||||||
{
|
{
|
||||||
//parent::__construct();
|
//parent::__construct();
|
||||||
@ -26,16 +32,26 @@ class ProductController extends BaseController
|
|||||||
$this->productService = $productService;
|
$this->productService = $productService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
return Redirect::to('settings/' . ACCOUNT_PRODUCTS);
|
return Redirect::to('settings/' . ACCOUNT_PRODUCTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Http\JsonResponse
|
||||||
|
*/
|
||||||
public function getDatatable()
|
public function getDatatable()
|
||||||
{
|
{
|
||||||
return $this->productService->getDatatable(Auth::user()->account_id);
|
return $this->productService->getDatatable(Auth::user()->account_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $publicId
|
||||||
|
* @return \Illuminate\Contracts\View\View
|
||||||
|
*/
|
||||||
public function edit($publicId)
|
public function edit($publicId)
|
||||||
{
|
{
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
@ -52,6 +68,9 @@ class ProductController extends BaseController
|
|||||||
return View::make('accounts.product', $data);
|
return View::make('accounts.product', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Contracts\View\View
|
||||||
|
*/
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
@ -68,16 +87,27 @@ class ProductController extends BaseController
|
|||||||
return View::make('accounts.product', $data);
|
return View::make('accounts.product', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
public function store()
|
public function store()
|
||||||
{
|
{
|
||||||
return $this->save();
|
return $this->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $publicId
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
public function update($publicId)
|
public function update($publicId)
|
||||||
{
|
{
|
||||||
return $this->save($publicId);
|
return $this->save($publicId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $productPublicId
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
private function save($productPublicId = false)
|
private function save($productPublicId = false)
|
||||||
{
|
{
|
||||||
if ($productPublicId) {
|
if ($productPublicId) {
|
||||||
@ -99,6 +129,9 @@ class ProductController extends BaseController
|
|||||||
return Redirect::to('settings/' . ACCOUNT_PRODUCTS);
|
return Redirect::to('settings/' . ACCOUNT_PRODUCTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
public function bulk()
|
public function bulk()
|
||||||
{
|
{
|
||||||
$action = Input::get('bulk_action');
|
$action = Input::get('bulk_action');
|
||||||
|
@ -1,13 +1,8 @@
|
|||||||
<?php namespace App\Http\Controllers;
|
<?php namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
use Input;
|
|
||||||
use Utils;
|
|
||||||
use Response;
|
use Response;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Ninja\Repositories\InvoiceRepository;
|
use App\Ninja\Repositories\InvoiceRepository;
|
||||||
use App\Http\Controllers\BaseAPIController;
|
|
||||||
use App\Ninja\Transformers\QuoteTransformer;
|
|
||||||
|
|
||||||
class QuoteApiController extends BaseAPIController
|
class QuoteApiController extends BaseAPIController
|
||||||
{
|
{
|
||||||
|
@ -6,25 +6,18 @@ use Redirect;
|
|||||||
use Utils;
|
use Utils;
|
||||||
use View;
|
use View;
|
||||||
use Cache;
|
use Cache;
|
||||||
use Event;
|
|
||||||
use Session;
|
use Session;
|
||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\Country;
|
use App\Models\Country;
|
||||||
use App\Models\Currency;
|
|
||||||
use App\Models\Industry;
|
|
||||||
use App\Models\InvoiceDesign;
|
use App\Models\InvoiceDesign;
|
||||||
use App\Models\PaymentTerm;
|
|
||||||
use App\Models\Product;
|
use App\Models\Product;
|
||||||
use App\Models\Size;
|
|
||||||
use App\Models\TaxRate;
|
use App\Models\TaxRate;
|
||||||
use App\Models\Invitation;
|
use App\Models\Invitation;
|
||||||
use App\Models\Activity;
|
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Ninja\Mailers\ContactMailer as Mailer;
|
use App\Ninja\Mailers\ContactMailer as Mailer;
|
||||||
use App\Ninja\Repositories\InvoiceRepository;
|
use App\Ninja\Repositories\InvoiceRepository;
|
||||||
use App\Ninja\Repositories\ClientRepository;
|
use App\Ninja\Repositories\ClientRepository;
|
||||||
use App\Events\QuoteInvitationWasApproved;
|
|
||||||
use App\Services\InvoiceService;
|
use App\Services\InvoiceService;
|
||||||
use App\Http\Requests\InvoiceRequest;
|
use App\Http\Requests\InvoiceRequest;
|
||||||
|
|
||||||
@ -126,7 +119,7 @@ class QuoteController extends BaseController
|
|||||||
return [
|
return [
|
||||||
'entityType' => ENTITY_QUOTE,
|
'entityType' => ENTITY_QUOTE,
|
||||||
'account' => Auth::user()->account,
|
'account' => Auth::user()->account,
|
||||||
'products' => Product::scope()->orderBy('id')->get(array('product_key', 'notes', 'cost', 'qty')),
|
'products' => Product::scope()->orderBy('id')->get(['product_key', 'notes', 'cost', 'qty']),
|
||||||
'taxRateOptions' => $options,
|
'taxRateOptions' => $options,
|
||||||
'defaultTax' => $defaultTax,
|
'defaultTax' => $defaultTax,
|
||||||
'countries' => Cache::get('countries'),
|
'countries' => Cache::get('countries'),
|
||||||
@ -160,15 +153,15 @@ class QuoteController extends BaseController
|
|||||||
$count = $this->invoiceService->bulk($ids, $action);
|
$count = $this->invoiceService->bulk($ids, $action);
|
||||||
|
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
$key = $action == 'markSent' ? "updated_quote" : "{$action}d_quote";
|
$key = $action == 'markSent' ? 'updated_quote' : "{$action}d_quote";
|
||||||
$message = Utils::pluralize($key, $count);
|
$message = Utils::pluralize($key, $count);
|
||||||
Session::flash('message', $message);
|
Session::flash('message', $message);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'restore' && $count == 1) {
|
if ($action == 'restore' && $count == 1) {
|
||||||
return Redirect::to("quotes/".Utils::getFirst($ids));
|
return Redirect::to('quotes/'.Utils::getFirst($ids));
|
||||||
} else {
|
} else {
|
||||||
return Redirect::to("quotes");
|
return Redirect::to('quotes');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,10 +3,20 @@
|
|||||||
use Utils;
|
use Utils;
|
||||||
use App\Ninja\Repositories\InvoiceRepository;
|
use App\Ninja\Repositories\InvoiceRepository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class RecurringInvoiceController
|
||||||
|
*/
|
||||||
class RecurringInvoiceController extends BaseController
|
class RecurringInvoiceController extends BaseController
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var InvoiceRepository
|
||||||
|
*/
|
||||||
protected $invoiceRepo;
|
protected $invoiceRepo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RecurringInvoiceController constructor.
|
||||||
|
* @param InvoiceRepository $invoiceRepo
|
||||||
|
*/
|
||||||
public function __construct(InvoiceRepository $invoiceRepo)
|
public function __construct(InvoiceRepository $invoiceRepo)
|
||||||
{
|
{
|
||||||
//parent::__construct();
|
//parent::__construct();
|
||||||
@ -14,6 +24,9 @@ class RecurringInvoiceController extends BaseController
|
|||||||
$this->invoiceRepo = $invoiceRepo;
|
$this->invoiceRepo = $invoiceRepo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$data = [
|
$data = [
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user