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


PHP app\App类代码示例

本文整理汇总了PHP中app\App的典型用法代码示例。如果您正苦于以下问题:PHP App类的具体用法?PHP App怎么用?PHP App使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $access_token = generate_access_token();
     $email = 'a1t1-' . generate_email() . '@telegramlogin.com';
     $user = new User();
     $user->name = 'david pichsenmeister';
     $user->username = 'pichsenmeister';
     $user->email = $email;
     $user->telegram_id = 41478911;
     $user->access_token = $access_token;
     $user->save();
     $app = new App();
     $app->user_id = $user->id;
     $app->name = 'Telegram Login';
     $app->client_id = 314159265;
     $app->client_secret = generate_client_secret();
     $app->website = env('URL');
     $app->redirect_url = env('URL') . '/login';
     $app->save();
     $tg = new TelegramUser();
     $tg->telegram_id = 41478911;
     $tg->name = 'david pichsenmeister';
     $tg->username = 'pichsenmeister';
     $tg->save();
     $auth = new Auth();
     $auth->app_id = $app->id;
     $auth->telegram_user_id = $tg->id;
     $auth->email = $email;
     $auth->access_token = $access_token;
     $auth->save();
 }
开发者ID:3x14159265,项目名称:telegramlogin,代码行数:36,代码来源:UserTableSeeder.php

示例2: __construct

 /**
  * Method to instantiate the view.
  *
  * @param   App             $app             The application object.
  * @param   ModelInterface  $model           The model object.
  * @param   string|array    $templatesPaths  The templates paths.
  *
  * @throws  \RuntimeException
  * @since   1.0
  */
 public function __construct(App $app, ModelInterface $model, $templatesPaths = '')
 {
     parent::__construct($model);
     $this->app = $app;
     $renderer = $app->getContainer()->get('config')->get('renderer.type');
     $className = 'App\\View\\Renderer\\' . ucfirst($renderer);
     if (false == class_exists($className)) {
         throw new \RuntimeException(sprintf('Invalid renderer: %s', $renderer));
     }
     $config = array();
     $config['templates_base_dir'] = JPATH_TEMPLATES;
     // Load the renderer.
     $this->renderer = new $className($config);
     // Register application's Twig extension.
     $this->renderer->addExtension(new TwigExtension($app));
     // Register additional paths.
     if (!empty($templatesPaths)) {
         $this->renderer->setTemplatesPaths($templatesPaths, true);
     }
     // Register the theme path
     $this->renderer->set('themePath', DEFAULT_THEME . '/');
     // Retrieve and clear the message queue
     $this->renderer->set('flashBag', $app->getMessageQueue());
     $app->clearMessageQueue();
 }
开发者ID:KBO-Techo-Dev,项目名称:MagazinePro-jfw,代码行数:35,代码来源:DefaultHtmlView.php

示例3: getGenres

 /**
  * Récupère les genres d'un album
  */
 public function getGenres()
 {
     if (isset($this->id)) {
         $this->genres = App::getInstance()->getTable('Genres')->allByAlbum($this->id);
         $this->total_genres = count($this->genres);
     }
 }
开发者ID:kMeillet,项目名称:mp3-player-api-js,代码行数:10,代码来源:AlbumsEntity.php

示例4: getUser

 private function getUser($code, $state)
 {
     $app = App::findByClientId(314159265);
     $params = array('code' => $code, 'client_id' => $app->client_id, 'client_secret' => $app->client_secret);
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, env('URL') . '/code');
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
     $json = curl_exec($ch);
     $result = json_decode($json, true);
     if (!array_key_exists('access_token', $result)) {
         app()->abort($result['error'], $result['description']);
     }
     if (array_key_exists('active', $result) && !$result['active']) {
         app()->abort($result['error'], $result['description']);
     }
     $tg = TelegramUser::findByTelegramId($result['telegram_user']['telegram_id']);
     if ($tg->status != $state) {
         app()->abort(403, 'Invalid state.');
     }
     $tg->status = 'access_granted';
     $tg->save();
     try {
         $user = User::findByTelegramId($result['telegram_user']['telegram_id']);
     } catch (ModelNotFoundException $e) {
         $user = new User();
         $user->email = $result['email'];
         $user->telegram_id = $result['telegram_user']['telegram_id'];
     }
     $user->access_token = $result['access_token'];
     $user->name = $result['telegram_user']['name'];
     $user->username = $result['telegram_user']['username'];
     $user->save();
     return $user;
 }
开发者ID:3x14159265,项目名称:telegramlogin,代码行数:35,代码来源:UserController.php

示例5: actionDelete

 public function actionDelete()
 {
     if (!isset($_POST['imageId'])) {
         App::instance()->show404();
         exit;
     }
     /** @var \models\Image $model */
     $model = Image::findByID((int) $_POST['imageId']);
     if (!$model || $model->uid != App::instance()->getUser()->getId()) {
         App::instance()->show404();
         exit;
     }
     if ($model->delete()) {
         $response['error'] = false;
     } else {
         $response = json_encode(['error' => true]);
     }
     if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && 'XMLHttpRequest' === $_SERVER['HTTP_X_REQUESTED_WITH']) {
         $response['totalCount'] = Image::countByProp('uid', App::instance()->getUser()->getId());
         echo json_encode($response);
     } else {
         $this->redirect('/site/index/');
         echo $response;
     }
 }
开发者ID:VlPetukhov,项目名称:summa.local,代码行数:25,代码来源:SiteController.php

示例6: __construct

 public function __construct(array $attributes = [])
 {
     parent::__construct($attributes);
     $this->errors = new MessageBag();
     $this->validator = \App::make('validator');
     $this->manejaConcurrencia = true;
 }
开发者ID:kentronvzla,项目名称:webkentron,代码行数:7,代码来源:BaseModel.php

示例7: login

 /**
  * login process
  */
 public static function login()
 {
     // form validation
     if (!filter_input(INPUT_POST, "form_token") || Form::isFormTokenValid(filter_input(INPUT_POST, "form_token"))) {
         View::setMessageFlash("danger", "Form tidak valid");
         return FALSE;
     }
     if (!filter_input(INPUT_POST, "username") || !filter_input(INPUT_POST, "password")) {
         View::setMessageFlash("danger", "Masukkan Username dan Password");
         return FALSE;
     }
     $username = filter_input(INPUT_POST, "username", FILTER_SANITIZE_STRING);
     $password = md5(filter_input(INPUT_POST, "password", FILTER_SANITIZE_STRING));
     $mysqli = App::getConnection(true);
     $sql = "SELECT user_id FROM users WHERE username='{$username}' AND password='{$password}'";
     if (!($query = $mysqli->query($sql))) {
         View::setMessageFlash("danger", $mysqli->error);
         return FALSE;
     }
     if ($query->num_rows == 0) {
         View::setMessageFlash("danger", "Username dan Password Salah");
         return FALSE;
     }
     $row = $query->fetch_row();
     $_SESSION['user_id'] = $row[0];
     return TRUE;
 }
开发者ID:bahrul221,项目名称:tc-tgm,代码行数:30,代码来源:LoginController.php

示例8: translation

 public function translation($language = null)
 {
     if ($language == null) {
         $language = App::getLocale();
     }
     return $this->hasMany('App\\CategoryTranslation')->where('language_id', '=', $language);
 }
开发者ID:TEACHER-KEAK,项目名称:GAD,代码行数:7,代码来源:Category.php

示例9: config

 private static function config()
 {
     if (!static::$Config) {
         static::$Config = App::config('db');
     }
     return static::$Config;
 }
开发者ID:Akujin,项目名称:divergence,代码行数:7,代码来源:MySQL.php

示例10: actionLogout

 public function actionLogout()
 {
     if (!App::instance()->isGuest()) {
         App::instance()->logoutUser();
     }
     $this->redirect('/site/index/');
 }
开发者ID:VlPetukhov,项目名称:summa.local,代码行数:7,代码来源:UserController.php

示例11: getAlbums

 /**
  * Récupère les albums d'un artiste
  */
 public function getAlbums()
 {
     if (isset($this->id)) {
         $this->albums = App::getInstance()->getTable('Albums')->allByArtist($this->id);
         $this->total_albums = count($this->albums);
     }
 }
开发者ID:kMeillet,项目名称:mp3-player-api-js,代码行数:10,代码来源:ArtistsEntity.php

示例12: getLastWithCategories

 public static function getLastWithCategories()
 {
     return App::getDatabase()->query('
         SELECT article.id, article.titre, article.contenu, categories.titre as categorie
         FROM article
         LEFT JOIN categories
           ON categories.id = article.category_id', __CLASS__);
 }
开发者ID:NK-WEB-Git,项目名称:cosmosphp,代码行数:8,代码来源:Article.php

示例13: instance

 /**
  * Returns the singleton instance of this class.
  *
  * @return DatabaseService
  */
 public static function instance()
 {
     if (!isset(self::$instance)) {
         $db = App::instance()->config['db'];
         self::$instance = new \PDO('mysql:host=' . $db['host'] . ';dbname=' . $db['name'], $db['username'], $db['password'], $db['options']);
     }
     return self::$instance;
 }
开发者ID:nikolayh,项目名称:simple-php-api,代码行数:13,代码来源:DatabaseService.php

示例14: appView

 public function appView($app_id)
 {
     $appInfo = App::dataHandle(App::find($app_id));
     if (!$appInfo) {
         header('Location:' . action('App\\Http\\Controllers\\HomeController@index'));
     }
     $commendApps = App::dataHandle(App::where('category_id', '=', $appInfo->category_id)->where('id', '!=', $app_id)->orderBy('download', 'desc')->take(4)->get());
     return view('index.appView')->with(['appInfo' => $appInfo, 'commendApps' => $commendApps]);
 }
开发者ID:kevinwan,项目名称:che123,代码行数:9,代码来源:IndexController.php

示例15: __construct

 public function __construct($id)
 {
     $mysqli = App::getConnection(true);
     $sql = "SELECT * FROM " . $this->table . " WHERE " . $this->key . " = '" . $id . "'";
     if (!($query = $mysqli->query($sql))) {
         return;
     }
     $this->data = $query->fetch_assoc();
 }
开发者ID:bahrul221,项目名称:tc-tgm,代码行数:9,代码来源:Model.php


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