mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 03:29:03 -05:00 
			
		
		
		
	
		
			
				
	
	
		
			46 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
/**
 | 
						|
 * Invoice Ninja (https://invoiceninja.com).
 | 
						|
 *
 | 
						|
 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
						|
 *
 | 
						|
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
						|
 *
 | 
						|
 * @license https://www.elastic.co/licensing/elastic-license
 | 
						|
 */
 | 
						|
 | 
						|
namespace App\Http\Controllers\ClientPortal;
 | 
						|
 | 
						|
use App\Http\Controllers\Controller;
 | 
						|
use App\Models\RecurringInvoice;
 | 
						|
use App\Utils\Ninja;
 | 
						|
use Illuminate\Http\Request;
 | 
						|
 | 
						|
class SubscriptionController extends Controller
 | 
						|
{
 | 
						|
    public function index()
 | 
						|
    {
 | 
						|
 | 
						|
        if(Ninja::isHosted()){
 | 
						|
 | 
						|
 | 
						|
            $count = RecurringInvoice::query()
 | 
						|
                ->where('client_id', auth('contact')->user()->client->id)
 | 
						|
                ->where('company_id', auth('contact')->user()->client->company_id)
 | 
						|
                ->where('status_id', RecurringInvoice::STATUS_ACTIVE)
 | 
						|
                ->where('is_deleted', 0)
 | 
						|
                ->whereNotNull('subscription_id')
 | 
						|
                ->withTrashed()
 | 
						|
                ->count();
 | 
						|
 | 
						|
                if($count == 0)
 | 
						|
                    return redirect()->route('client.ninja_contact_login', ['contact_key' => auth('contact')->user()->contact_key, 'company_key' => auth('contact')->user()->company->company_key]);
 | 
						|
 | 
						|
        }
 | 
						|
 | 
						|
 | 
						|
        return render('subscriptions.index');
 | 
						|
    }
 | 
						|
}
 |