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


PHP Author::findAll方法代码示例

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


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

示例1: actionIndex

 public function actionIndex()
 {
     $this->view->news = Article::findAllWithGenerator();
     $this->view->table = (new AdminDataTable(Author::findAll(), [function ($model) {
         return $model->getName();
     }, function ($model) {
         return $model->getEmail();
     }]))->render();
     $this->view->display(__DIR__ . '/../../templates/admin.php');
 }
开发者ID:AlexPanich,项目名称:php2-dz1,代码行数:10,代码来源:Admin.php

示例2: actionSave

 /**
  * Экшен для сохранения новости
  */
 protected function actionSave()
 {
     $article = \App\Models\Article::giveOne($_POST['id']);
     if (false === $article) {
         throw new \App\Exceptions\ObjectNotFound('Запрашиваемый объект не найден');
     }
     $article->fill($_POST);
     $article->author = \App\Models\Author::giveOne($_POST['author_id']);
     try {
         $article->save();
         $this->redirect('/admin');
     } catch (\App\MultiException $ex) {
         $this->view->article = $article;
         $this->view->authors = \App\Models\Author::findAll();
         $this->view->errors = $ex;
         $this->view->display(__DIR__ . '/../../templates/admin/news/tmp_edit.php');
     }
 }
开发者ID:KnyazkovAlexey,项目名称:php2_homework_Knyazkov,代码行数:21,代码来源:News.php

示例3: actionEdit

 protected function actionEdit()
 {
     $id = $_GET['id'] ?? false;
     if (false !== $id) {
         if (false === ($article = \App\Models\News::findByID($id))) {
             throw new \App\Exceptions\NotFound($_SERVER['REQUEST_URI']);
         }
     } else {
         $article = new \App\Models\News();
     }
     if (!empty($_POST)) {
         try {
             $article->fillByPost($_POST);
         } catch (MultiException $e) {
             $this->view->display('edit.php', ['article' => $article, 'authors' => \App\Models\Author::findAll(), 'errors' => $e]);
             exit(0);
         }
         $this->redirectIf('/admin/news/index', $article->save());
     }
     $this->view->display('edit.php', ['article' => $article, 'authors' => \App\Models\Author::findAll()]);
 }
开发者ID:scorp7mix,项目名称:pr-of-it.php2,代码行数:21,代码来源:News.php

示例4: actionAuthors

 protected function actionAuthors()
 {
     $authors = Author::findAll();
     $table = new AdminDataTable($authors, [function (Author $author) {
         return $author->firstname;
     }, function (Author $author) {
         return $author->lastname;
     }, function (Author $author) {
         return $author->email;
     }]);
     $this->view->render('/admin/authors.html', ['authors' => $table->render()]);
 }
开发者ID:eropkinvitaliy,项目名称:PHP-2-profit,代码行数:12,代码来源:Admin.php

示例5: gettype

<?php

/**
 * Подключение файла автозагрузки
 */
require_once __DIR__ . '/../../autoload.php';
$view = new \App\View();
$view->title = 'Админ-панель';
$view->content = 'Контент';
$view->authors = \App\Models\Author::findAll();
/*
foreach($view->authors as $key => $value) {
    echo gettype($value) . '<br>';

    if (!is_object($value) && !is_array($value)) {
        continue;
    }
    echo ++$key . '). ';
    $iter = new App\MyIterator($value);

    foreach ($iter as $k => $v) {
        if (!is_object($v) && !is_array($v)) {
            echo $k . ' = ' . $v . '; ';
            continue;
        }

        $iter2 = new App\MyIterator($v);

        foreach ($iter2 as $k2 => $v2) {
            echo $k2 . ' = ' . $v2 . '; ';
        }
开发者ID:webmaza75,项目名称:php2,代码行数:31,代码来源:iterator.php


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