当前位置: 首页>>代码示例>>PHP>>正文


PHP Account::count方法代码示例

本文整理汇总了PHP中app\models\Account::count方法的典型用法代码示例。如果您正苦于以下问题:PHP Account::count方法的具体用法?PHP Account::count怎么用?PHP Account::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Account的用法示例。


在下文中一共展示了Account::count方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getStarted

 public function getStarted()
 {
     if (Auth::check()) {
         return Redirect::to('invoices/create');
     }
     if (!Utils::isNinja() && !Utils::allowNewAccounts() && Account::count() > 0) {
         return Redirect::to('/login');
     }
     $user = false;
     $guestKey = Input::get('guest_key');
     if ($guestKey) {
         $user = User::where('password', '=', $guestKey)->first();
         if ($user && $user->registered) {
             return Redirect::to('/');
         }
     }
     if (!$user) {
         $account = $this->accountRepo->create();
         $user = $account->users()->first();
         Session::forget(RECENTLY_VIEWED);
     }
     Auth::login($user, true);
     Event::fire(new UserLoggedIn());
     return Redirect::to('invoices/create')->with('sign_up', Input::get('sign_up'));
 }
开发者ID:ricoa,项目名称:invoice-ninja,代码行数:25,代码来源:AccountController.php

示例2: getStarted

 public function getStarted()
 {
     $user = false;
     $guestKey = Input::get('guest_key');
     // local storage key to login until registered
     $prevUserId = Session::pull(PREV_USER_ID);
     // last user id used to link to new account
     if (Auth::check()) {
         return Redirect::to('invoices/create');
     }
     if (!Utils::isNinja() && (Account::count() > 0 && !$prevUserId)) {
         return Redirect::to('/login');
     }
     if ($guestKey && !$prevUserId) {
         $user = User::where('password', '=', $guestKey)->first();
         if ($user && $user->registered) {
             return Redirect::to('/');
         }
     }
     if (!$user) {
         $account = $this->accountRepo->create();
         $user = $account->users()->first();
         Session::forget(RECENTLY_VIEWED);
         if ($prevUserId) {
             $users = $this->accountRepo->associateAccounts($user->id, $prevUserId);
             Session::put(SESSION_USER_ACCOUNTS, $users);
         }
     }
     Auth::login($user, true);
     event(new UserLoggedIn());
     $redirectTo = Input::get('redirect_to') ?: 'invoices/create';
     return Redirect::to($redirectTo)->with('sign_up', Input::get('sign_up'));
 }
开发者ID:jroblesc,项目名称:invoiceninja,代码行数:33,代码来源:AccountController.php

示例3: showSetup

 public function showSetup()
 {
     if (Utils::isNinja() || Utils::isDatabaseSetup() && Account::count() > 0) {
         return Redirect::to('/');
     }
     $view = View::make('setup');
     return Response::make($view);
 }
开发者ID:ricoa,项目名称:invoice-ninja,代码行数:8,代码来源:AppController.php

示例4: showIndex

 public function showIndex()
 {
     Session::reflash();
     if (!Utils::isNinja() && (!Utils::isDatabaseSetup() || Account::count() == 0)) {
         return Redirect::to('/setup');
     } elseif (Auth::check()) {
         return Redirect::to('/dashboard');
     } else {
         return Redirect::to('/login');
     }
 }
开发者ID:jorisvandesande,项目名称:invoice-ninja,代码行数:11,代码来源:HomeController.php

示例5: showIndex

 public function showIndex()
 {
     Artisan::call('cache:clear', array());
     // Artisan::call('Cache:clear',array());
     Session::reflash();
     if (!Utils::isNinja() && (!Utils::isDatabaseSetup() || Account::count() == 0)) {
         return Redirect::to('/setup');
     } elseif (Auth::check()) {
         return Redirect::to('/dashboard');
     } else {
         return Redirect::to('/login');
     }
 }
开发者ID:GhDj,项目名称:erp-fac-fin,代码行数:13,代码来源:HomeController.php

示例6: doSetup

 public function doSetup()
 {
     if (Utils::isNinjaProd() || Utils::isDatabaseSetup() && Account::count() > 0) {
         return Redirect::to('/');
     }
     $valid = false;
     $test = Input::get('test');
     $app = Input::get('app');
     $app['key'] = str_random(RANDOM_KEY_LENGTH);
     $database = Input::get('database');
     $dbType = $database['default'];
     $database['connections'] = [$dbType => $database['type']];
     $mail = Input::get('mail');
     $email = $mail['username'];
     $mail['from']['address'] = $email;
     if ($test == 'mail') {
         return self::testMail($mail);
     }
     $valid = self::testDatabase($database);
     if ($test == 'db') {
         return $valid === true ? 'Success' : $valid;
     } elseif (!$valid) {
         return Redirect::to('/setup')->withInput();
     }
     $config = "APP_ENV=production\n" . "APP_DEBUG=false\n" . "APP_URL={$app['url']}\n" . "APP_KEY={$app['key']}\n\n" . "DB_TYPE={$dbType}\n" . "DB_HOST={$database['type']['host']}\n" . "DB_DATABASE={$database['type']['database']}\n" . "DB_USERNAME={$database['type']['username']}\n" . "DB_PASSWORD={$database['type']['password']}\n\n" . "MAIL_DRIVER={$mail['driver']}\n" . "MAIL_PORT={$mail['port']}\n" . "MAIL_ENCRYPTION={$mail['encryption']}\n" . "MAIL_HOST={$mail['host']}\n" . "MAIL_USERNAME={$mail['username']}\n" . "MAIL_FROM_NAME={$mail['from']['name']}\n" . "MAIL_PASSWORD={$mail['password']}\n\n" . "#PHANTOMJS_CLOUD_KEY='a-demo-key-with-low-quota-per-ip-address'";
     // Write Config Settings
     $fp = fopen(base_path() . "/.env", 'w');
     fwrite($fp, $config);
     fclose($fp);
     // == DB Migrate & Seed == //
     // Artisan::call('migrate:rollback', array('--force' => true)); // Debug Purposes
     Artisan::call('migrate', array('--force' => true));
     if (Industry::count() == 0) {
         Artisan::call('db:seed', array('--force' => true));
     }
     Cache::flush();
     Artisan::call('optimize', array('--force' => true));
     $firstName = trim(Input::get('first_name'));
     $lastName = trim(Input::get('last_name'));
     $email = trim(strtolower(Input::get('email')));
     $password = trim(Input::get('password'));
     $account = $this->accountRepo->create($firstName, $lastName, $email, $password);
     $user = $account->users()->first();
     return Redirect::to('/login');
 }
开发者ID:nafrente,项目名称:invoice-ninja,代码行数:45,代码来源:AppController.php

示例7: updateSetup

 public function updateSetup()
 {
     if (Utils::isNinjaProd()) {
         return Redirect::to('/');
     }
     if (!Auth::check() && Utils::isDatabaseSetup() && Account::count() > 0) {
         return Redirect::to('/');
     }
     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>');
         return Redirect::to('/settings/system_settings');
     }
     $app = Input::get('app');
     $db = Input::get('database');
     $mail = Input::get('mail');
     $_ENV['APP_URL'] = $app['url'];
     $_ENV['APP_DEBUG'] = Input::get('debug') ? 'true' : 'false';
     $_ENV['DB_TYPE'] = 'mysql';
     // $db['default'];
     $_ENV['DB_HOST'] = $db['type']['host'];
     $_ENV['DB_DATABASE'] = $db['type']['database'];
     $_ENV['DB_USERNAME'] = $db['type']['username'];
     $_ENV['DB_PASSWORD'] = $db['type']['password'];
     if ($mail) {
         $_ENV['MAIL_DRIVER'] = $mail['driver'];
         $_ENV['MAIL_PORT'] = $mail['port'];
         $_ENV['MAIL_ENCRYPTION'] = $mail['encryption'];
         $_ENV['MAIL_HOST'] = $mail['host'];
         $_ENV['MAIL_USERNAME'] = $mail['username'];
         $_ENV['MAIL_FROM_NAME'] = $mail['from']['name'];
         $_ENV['MAIL_PASSWORD'] = $mail['password'];
         $_ENV['MAIL_FROM_ADDRESS'] = $mail['username'];
     }
     $config = '';
     foreach ($_ENV as $key => $val) {
         $config .= "{$key}={$val}\n";
     }
     $fp = fopen(base_path() . "/.env", 'w');
     fwrite($fp, $config);
     fclose($fp);
     Session::flash('message', trans('texts.updated_settings'));
     return Redirect::to('/settings/system_settings');
 }
开发者ID:Fadnis,项目名称:invoiceninja,代码行数:43,代码来源:AppController.php


注:本文中的app\models\Account::count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。