diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index 4574ad48b870..44aa7a0c5e22 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -11,6 +11,7 @@ use Utils; use Validator; use View; use stdClass; +use Cache; use App\Models\User; use App\Models\Activity; @@ -129,30 +130,16 @@ class AccountController extends BaseController public function showSection($section = ACCOUNT_DETAILS, $subSection = false) { if ($section == ACCOUNT_DETAILS) { - /* Update Remember Function $data = [ 'account' => Account::with('users')->findOrFail(Auth::user()->account_id), - 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), - 'sizes' => Size::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), - 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), - 'timezones' => Timezone::remember(DEFAULT_QUERY_CACHE)->orderBy('location')->get(), - 'dateFormats' => DateFormat::remember(DEFAULT_QUERY_CACHE)->get(), - 'datetimeFormats' => DatetimeFormat::remember(DEFAULT_QUERY_CACHE)->get(), - 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), - 'languages' => Language::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), - 'showUser' => Auth::user()->id === Auth::user()->account->users()->first()->id, - ]; - */ - $data = [ - 'account' => Account::with('users')->findOrFail(Auth::user()->account_id), - 'countries' => Country::orderBy('name')->get(), - 'sizes' => Size::orderBy('id')->get(), - 'industries' => Industry::orderBy('name')->get(), - 'timezones' => Timezone::orderBy('location')->get(), - 'dateFormats' => DateFormat::get(), - 'datetimeFormats' => DatetimeFormat::get(), - 'currencies' => Currency::orderBy('name')->get(), - 'languages' => Language::orderBy('name')->get(), + 'countries' => Cache::get('countries'), + 'sizes' => Cache::get('sizes'), + 'industries' => Cache::get('industries'), + 'timezones' => Cache::get('timezones'), + 'dateFormats' => Cache::get('dateFormats'), + 'datetimeFormats' => Cache::get('datetimeFormats'), + 'currencies' => Cache::get('currencies'), + 'languages' => Cache::get('languages'), 'showUser' => Auth::user()->id === Auth::user()->account->users()->first()->id, ]; @@ -210,8 +197,6 @@ class AccountController extends BaseController $invoice->invoice_items = [$invoiceItem]; $data['invoice'] = $invoice; - //$data['invoiceDesigns'] = InvoiceDesign::remember(DEFAULT_QUERY_CACHE, 'invoice_designs_cache_'.Auth::user()->maxInvoiceDesignId()) - // ->where('id', '<=', Auth::user()->maxInvoiceDesignId())->orderBy('id')->get(); $data['invoiceDesigns'] = InvoiceDesign::where('id', '<=', Auth::user()->maxInvoiceDesignId())->orderBy('id')->get(); } else if ($subSection == ACCOUNT_EMAIL_TEMPLATES) { $data['invoiceEmail'] = $account->getEmailTemplate(ENTITY_INVOICE); @@ -391,7 +376,7 @@ class AccountController extends BaseController $count = 0; $hasHeaders = Input::get('header_checkbox'); - $countries = Country::remember(DEFAULT_QUERY_CACHE)->get(); + $countries = Cache::get('countries'); $countryMap = []; foreach ($countries as $country) { diff --git a/app/Http/Controllers/ClientController.php b/app/Http/Controllers/ClientController.php index 741961572d8c..d2b1205023c5 100644 --- a/app/Http/Controllers/ClientController.php +++ b/app/Http/Controllers/ClientController.php @@ -9,6 +9,7 @@ use Validator; use Input; use Session; use Redirect; +use Cache; use App\Models\Activity; use App\Models\Client; @@ -178,23 +179,12 @@ class ClientController extends BaseController private static function getViewModel() { - /* Remember function no longer works return [ - 'sizes' => Size::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), - 'paymentTerms' => PaymentTerm::remember(DEFAULT_QUERY_CACHE)->orderBy('num_days')->get(['name', 'num_days']), - 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), - 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), - 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), - 'customLabel1' => Auth::user()->account->custom_client_label1, - 'customLabel2' => Auth::user()->account->custom_client_label2, - ]; - */ - return [ - 'sizes' => Size::orderBy('id')->get(), - 'paymentTerms' => PaymentTerm::orderBy('num_days')->get(['name', 'num_days']), - 'industries' => Industry::orderBy('name')->get(), - 'currencies' => Currency::orderBy('name')->get(), - 'countries' => Country::orderBy('name')->get(), + 'sizes' => Cache::get('sizes'), + 'paymentTerms' => Cache::get('paymentTerms'), + 'industries' => Cache::get('industries'), + 'currencies' => Cache::get('currencies'), + 'countries' => Cache::get('countries'), 'customLabel1' => Auth::user()->account->custom_client_label1, 'customLabel2' => Auth::user()->account->custom_client_label2, ]; diff --git a/app/Http/Controllers/CreditController.php b/app/Http/Controllers/CreditController.php index c895227772b5..44ffb42d1fcb 100644 --- a/app/Http/Controllers/CreditController.php +++ b/app/Http/Controllers/CreditController.php @@ -7,7 +7,7 @@ use Session; use Utils; use View; use Validator; - +zz use App\Models\Client; use App\Ninja\Repositories\CreditRepository; @@ -84,7 +84,6 @@ class CreditController extends BaseController 'method' => 'POST', 'url' => 'credits', 'title' => trans('texts.new_credit'), - //'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), //'invoices' => Invoice::scope()->with('client', 'invoice_status')->orderBy('invoice_number')->get(), 'clients' => Client::scope()->with('contacts')->orderBy('name')->get(), ); @@ -102,7 +101,6 @@ class CreditController extends BaseController 'method' => 'PUT', 'url' => 'credits/'.$publicId, 'title' => 'Edit Credit', - //'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'clients' => Client::scope()->with('contacts')->orderBy('name')->get(), ); return View::make('credit.edit', $data); diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index 8fbc5b2211b3..6f931269f71a 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -321,43 +321,17 @@ class InvoiceController extends BaseController } } - /* return [ 'account' => Auth::user()->account, 'products' => Product::scope()->orderBy('id')->get(array('product_key', 'notes', 'cost', 'qty')), - 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), - 'clients' => Client::scope()->with('contacts', 'country')->orderBy('name')->get(), - 'taxRates' => TaxRate::scope()->orderBy('name')->get(), - 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), - 'sizes' => Size::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), - 'paymentTerms' => PaymentTerm::remember(DEFAULT_QUERY_CACHE)->orderBy('num_days')->get(['name', 'num_days']), - 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), - 'invoiceDesigns' => InvoiceDesign::remember(DEFAULT_QUERY_CACHE, 'invoice_designs_cache_'.Auth::user()->maxInvoiceDesignId()) - ->where('id', '<=', Auth::user()->maxInvoiceDesignId())->orderBy('id')->get(), - 'frequencies' => array( - 1 => 'Weekly', - 2 => 'Two weeks', - 3 => 'Four weeks', - 4 => 'Monthly', - 5 => 'Three months', - 6 => 'Six months', - 7 => 'Annually', - ), - 'recurringHelp' => $recurringHelp - ]; - */ - - return [ - 'account' => Auth::user()->account, - 'products' => Product::scope()->orderBy('id')->get(array('product_key', 'notes', 'cost', 'qty')), - 'countries' => Country::orderBy('name')->get(), + 'countries' => Cache::get('countries'), 'clients' => Client::scope()->with('contacts', 'country')->orderBy('name')->get(), 'taxRates' => TaxRate::scope()->orderBy('name')->get(), 'currencies' => Cache::get('currencies'), - 'sizes' => Size::orderBy('id')->get(), - 'paymentTerms' => PaymentTerm::orderBy('num_days')->get(['name', 'num_days']), - 'industries' => Industry::orderBy('name')->get(), - 'invoiceDesigns' => InvoiceDesign::where('id', '<=', Auth::user()->maxInvoiceDesignId())->orderBy('id')->get(), + 'sizes' => Cache::get('sizes'), + 'paymentTerms' => Cache::get('paymentTerms'), + 'industries' => Cache::get('industries'), + 'invoiceDesigns' => InvoiceDesign::where('id', '<=', Auth::user()->maxInvoiceDesignId())->orderBy('id')->get(), 'frequencies' => array( 1 => 'Weekly', 2 => 'Two weeks', @@ -593,7 +567,7 @@ class InvoiceController extends BaseController 'invoice' => $invoice, 'versionsJson' => json_encode($versionsJson), 'versionsSelect' => $versionsSelect, - 'invoiceDesigns' => InvoiceDesign::remember(DEFAULT_QUERY_CACHE, 'invoice_designs_cache_'.Auth::user()->maxInvoiceDesignId())->where('id', '<=', Auth::user()->maxInvoiceDesignId())->orderBy('id')->get(), + 'invoiceDesigns' => InvoiceDesign::where('id', '<=', Auth::user()->maxInvoiceDesignId())->orderBy('id')->get(), ]; return View::make('invoices.history', $data); diff --git a/app/Http/Controllers/PaymentController.php b/app/Http/Controllers/PaymentController.php index aec7c8897ce0..3d2ac1aeab36 100644 --- a/app/Http/Controllers/PaymentController.php +++ b/app/Http/Controllers/PaymentController.php @@ -10,6 +10,7 @@ use Validator; use Omnipay; use CreditCard; use URL; +use Cache; use App\Models\Invoice; use App\Models\Invitation; @@ -151,8 +152,7 @@ class PaymentController extends BaseController 'method' => 'POST', 'url' => "payments", 'title' => trans('texts.new_payment'), - //'paymentTypes' => PaymentType::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), - 'paymentTypes' => PaymentType::orderBy('id')->get(), + 'paymentTypes' => Cache::get('paymentTypes'), 'clients' => Client::scope()->with('contacts')->orderBy('name')->get(), ); return View::make('payments.edit', $data); @@ -172,8 +172,7 @@ class PaymentController extends BaseController 'method' => 'PUT', 'url' => 'payments/'.$publicId, 'title' => trans('texts.edit_payment'), - //'paymentTypes' => PaymentType::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), - 'paymentTypes' => PaymentType::orderBy('id')->get(), + 'paymentTypes' => Cache::get('paymentTypes'), 'clients' => Client::scope()->with('contacts')->orderBy('name')->get(), ); return View::make('payments.edit', $data); @@ -368,8 +367,7 @@ class PaymentController extends BaseController 'paymentLibrary' => $paymentLibrary, 'gateway' => $gateway, 'acceptedCreditCardTypes' => $acceptedCreditCardTypes, - //'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), - 'countries' => Country::orderBy('name')->get(), + 'countries' => Cache::get('countries'), 'currencyId' => $client->currency_id, 'account' => $client->account ]; @@ -418,8 +416,7 @@ class PaymentController extends BaseController 'paymentLibrary' => $paymentLibrary, 'gateway' => $gateway, 'acceptedCreditCardTypes' => $acceptedCreditCardTypes, - //'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), - 'countries' => Country::orderBy('name')->get(), + 'countries' => Cache::get('countries'), 'currencyId' => 1, 'paymentTitle' => $affiliate->payment_title, 'paymentSubtitle' => $affiliate->payment_subtitle, diff --git a/app/Http/Controllers/QuoteController.php b/app/Http/Controllers/QuoteController.php index 620f50fe1270..93181e628b83 100644 --- a/app/Http/Controllers/QuoteController.php +++ b/app/Http/Controllers/QuoteController.php @@ -5,6 +5,7 @@ use Input; use Redirect; use Utils; use View; +use Cache; use App\Models\Account; use App\Models\Client; @@ -139,35 +140,17 @@ class QuoteController extends BaseController private static function getViewModel() { - /* - return [ - 'entityType' => ENTITY_QUOTE, - 'account' => Auth::user()->account, - 'products' => Product::scope()->orderBy('id')->get(array('product_key', 'notes', 'cost', 'qty')), - 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), - 'clients' => Client::scope()->with('contacts', 'country')->orderBy('name')->get(), - 'taxRates' => TaxRate::scope()->orderBy('name')->get(), - 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), - 'sizes' => Size::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), - 'paymentTerms' => PaymentTerm::remember(DEFAULT_QUERY_CACHE)->orderBy('num_days')->get(['name', 'num_days']), - 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), - 'invoiceDesigns' => InvoiceDesign::remember(DEFAULT_QUERY_CACHE, 'invoice_designs_cache_'.Auth::user()->maxInvoiceDesignId()) - ->where('id', '<=', Auth::user()->maxInvoiceDesignId())->orderBy('id')->get(), - 'invoiceLabels' => Auth::user()->account->getInvoiceLabels() - ]; -*/ - // TODO: Add Remember Cache return [ 'entityType' => ENTITY_QUOTE, 'account' => Auth::user()->account, 'products' => Product::scope()->orderBy('id')->get(array('product_key', 'notes', 'cost', 'qty')), - 'countries' => Country::orderBy('name')->get(), + 'countries' => Cache::get('countries'), 'clients' => Client::scope()->with('contacts', 'country')->orderBy('name')->get(), 'taxRates' => TaxRate::scope()->orderBy('name')->get(), - 'currencies' => Currency::orderBy('name')->get(), - 'sizes' => Size::orderBy('id')->get(), - 'paymentTerms' => PaymentTerm::orderBy('num_days')->get(['name', 'num_days']), - 'industries' => Industry::orderBy('name')->get(), + 'currencies' => Cache::get('currencies'), + 'sizes' => Cache::get('sizes'), + 'paymentTerms' => Cache::get('paymentTerms'), + 'industries' => Cache::get('industries'), 'invoiceDesigns' => InvoiceDesign::where('id', '<=', Auth::user()->maxInvoiceDesignId())->orderBy('id')->get(), 'invoiceLabels' => Auth::user()->account->getInvoiceLabels() ]; diff --git a/app/Http/Middleware/StartupCheck.php b/app/Http/Middleware/StartupCheck.php index fb0c7df3154f..361177721b25 100644 --- a/app/Http/Middleware/StartupCheck.php +++ b/app/Http/Middleware/StartupCheck.php @@ -1,4 +1,4 @@ -get()); +class StartupCheck +{ + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + */ + public function handle($request, Closure $next) + { + // Ensure all request are over HTTPS in production + if (App::environment() == ENV_PRODUCTION) { + if (!Request::secure()) { + return Redirect::secure(Request::getRequestUri()); + } } + // If the database doens't yet exist we'll skip the rest + if (!Utils::isNinja() && !Utils::isDatabaseSetup()) { + return $next($request); + } - // check the application is up to date and for any news feed messages - if (Auth::check()) - { - $count = Session::get(SESSION_COUNTER, 0); - Session::put(SESSION_COUNTER, ++$count); + // Check data has been cached + $cachedTables = [ + 'currencies' => 'App\Models\Currency', + 'sizes' => 'App\Models\Size', + 'industries' => 'App\Models\Industry', + 'timezones' => 'App\Models\Timezone', + 'dateFormats' => 'App\Models\DateFormat', + 'datetimeFormats' => 'App\Models\DatetimeFormat', + 'languages' => 'App\Models\Language', + 'paymentTerms' => 'App\Models\PaymentTerm', + 'paymentTypes' => 'App\Models\PaymentType', + ]; + foreach ($cachedTables as $name => $class) { + if (!Cache::has($name)) { + $orderBy = 'id'; - if (!Utils::startsWith($_SERVER['REQUEST_URI'], '/news_feed') && !Session::has('news_feed_id')) { - $data = false; - if (Utils::isNinja()) { - $data = Utils::getNewsFeedResponse(); - } else { - $file = @file_get_contents(NINJA_APP_URL . '/news_feed/' . Utils::getUserType() . '/' . NINJA_VERSION); - $data = @json_decode($file); - } - if ($data) { - if ($data->version != NINJA_VERSION) { - $params = [ - 'user_version' => NINJA_VERSION, - 'latest_version'=> $data->version, - 'releases_link' => link_to(RELEASES_URL, 'Invoice Ninja', ['target' => '_blank']) - ]; - Session::put('news_feed_id', NEW_VERSION_AVAILABLE); - Session::put('news_feed_message', trans('texts.new_version_available', $params)); - } else { - Session::put('news_feed_id', $data->id); - if ($data->message && $data->id > Auth::user()->news_feed_id) { - Session::put('news_feed_message', $data->message); - } - } - } else { - Session::put('news_feed_id', true); - } - } - } + if ($name == 'paymentTerms') { + $orderBy = 'num_days'; + } elseif (property_exists($class, 'name') && $name != 'paymentTypes') { + $orderBy = 'name'; + } + Cache::forever($name, $class::orderBy($orderBy)->get()); + } + } - // Check if we're requesting to change the account's language - if (Input::has('lang')) - { - $locale = Input::get('lang'); - App::setLocale($locale); - Session::set(SESSION_LOCALE, $locale); + // check the application is up to date and for any news feed messages + if (Auth::check()) { + $count = Session::get(SESSION_COUNTER, 0); + Session::put(SESSION_COUNTER, ++$count); - if (Auth::check()) - { - if ($language = Language::whereLocale($locale)->first()) - { - $account = Auth::user()->account; - $account->language_id = $language->id; - $account->save(); - } - } - } - else if (Auth::check()) - { - $locale = Session::get(SESSION_LOCALE, DEFAULT_LOCALE); - App::setLocale($locale); - } + if (!Utils::startsWith($_SERVER['REQUEST_URI'], '/news_feed') && !Session::has('news_feed_id')) { + $data = false; + if (Utils::isNinja()) { + $data = Utils::getNewsFeedResponse(); + } else { + $file = @file_get_contents(NINJA_APP_URL.'/news_feed/'.Utils::getUserType().'/'.NINJA_VERSION); + $data = @json_decode($file); + } + if ($data) { + if ($data->version != NINJA_VERSION) { + $params = [ + 'user_version' => NINJA_VERSION, + 'latest_version' => $data->version, + 'releases_link' => link_to(RELEASES_URL, 'Invoice Ninja', ['target' => '_blank']), + ]; + Session::put('news_feed_id', NEW_VERSION_AVAILABLE); + Session::put('news_feed_message', trans('texts.new_version_available', $params)); + } else { + Session::put('news_feed_id', $data->id); + if ($data->message && $data->id > Auth::user()->news_feed_id) { + Session::put('news_feed_message', $data->message); + } + } + } else { + Session::put('news_feed_id', true); + } + } + } - // Make sure the account/user localization settings are in the session - if (Auth::check() && !Session::has(SESSION_TIMEZONE)) - { + // Check if we're requesting to change the account's language + if (Input::has('lang')) { + $locale = Input::get('lang'); + App::setLocale($locale); + Session::set(SESSION_LOCALE, $locale); + + if (Auth::check()) { + if ($language = Language::whereLocale($locale)->first()) { + $account = Auth::user()->account; + $account->language_id = $language->id; + $account->save(); + } + } + } elseif (Auth::check()) { + $locale = Session::get(SESSION_LOCALE, DEFAULT_LOCALE); + App::setLocale($locale); + } + + // Make sure the account/user localization settings are in the session + if (Auth::check() && !Session::has(SESSION_TIMEZONE)) { Event::fire(new UserSettingsChanged()); - } + } - // Check if the user is claiming a license (ie, additional invoices, white label, etc.) - $claimingLicense = Utils::startsWith($_SERVER['REQUEST_URI'], '/claim_license'); - if (!$claimingLicense && Input::has('license_key') && Input::has('product_id')) - { - $licenseKey = Input::get('license_key'); - $productId = Input::get('product_id'); + // Check if the user is claiming a license (ie, additional invoices, white label, etc.) + $claimingLicense = Utils::startsWith($_SERVER['REQUEST_URI'], '/claim_license'); + if (!$claimingLicense && Input::has('license_key') && Input::has('product_id')) { + $licenseKey = Input::get('license_key'); + $productId = Input::get('product_id'); - $data = trim(file_get_contents((Utils::isNinjaDev() ? 'http://ninja.dev' : NINJA_APP_URL) . "/claim_license?license_key={$licenseKey}&product_id={$productId}")); + $data = trim(file_get_contents((Utils::isNinjaDev() ? 'http://ninja.dev' : NINJA_APP_URL)."/claim_license?license_key={$licenseKey}&product_id={$productId}")); - if ($productId == PRODUCT_INVOICE_DESIGNS) - { - if ($data = json_decode($data)) - { - foreach ($data as $item) - { - $design = new InvoiceDesign(); - $design->id = $item->id; - $design->name = $item->name; - $design->javascript = $item->javascript; - $design->save(); - } + if ($productId == PRODUCT_INVOICE_DESIGNS) { + if ($data = json_decode($data)) { + foreach ($data as $item) { + $design = new InvoiceDesign(); + $design->id = $item->id; + $design->name = $item->name; + $design->javascript = $item->javascript; + $design->save(); + } - if (!Utils::isNinjaProd()) { - Cache::forget('invoice_designs_cache_' . Auth::user()->maxInvoiceDesignId()); - } + if (!Utils::isNinjaProd()) { + Cache::forget('invoice_designs_cache_'.Auth::user()->maxInvoiceDesignId()); + } - Session::flash('message', trans('texts.bought_designs')); - } - } - else if ($productId == PRODUCT_WHITE_LABEL) - { - if ($data == 'valid') - { - $account = Auth::user()->account; - $account->pro_plan_paid = NINJA_DATE; - $account->save(); + Session::flash('message', trans('texts.bought_designs')); + } + } elseif ($productId == PRODUCT_WHITE_LABEL) { + if ($data == 'valid') { + $account = Auth::user()->account; + $account->pro_plan_paid = NINJA_DATE; + $account->save(); - Session::flash('message', trans('texts.bought_white_label')); - } - } - } - - return $next($request); - } + Session::flash('message', trans('texts.bought_white_label')); + } + } + } + return $next($request); + } } diff --git a/app/Models/Account.php b/app/Models/Account.php index a47dc417710c..ff896e30779e 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -193,7 +193,7 @@ class Account extends Eloquent public function getLocale() { - $language = Language::remember(DEFAULT_QUERY_CACHE)->where('id', '=', $this->account->language_id)->first(); + $language = Language::where('id', '=', $this->account->language_id)->first(); return $language->locale; } diff --git a/resources/views/header.blade.php b/resources/views/header.blade.php index 053266330854..d89c5d4fb069 100644 --- a/resources/views/header.blade.php +++ b/resources/views/header.blade.php @@ -176,37 +176,6 @@ @yield('content') -
- -
- @if (!Auth::check() || !Auth::user()->registered)