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


PHP Author::all方法代码示例

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


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

示例1: getIdNamePair

 /**
  * When editing or adding a new book, we need a select dropdown of authors to choose from
  * A select is easy to generate when you have a key=>value pair to work with
  * This method will generate a key=>value pair of author id => author name
  *
  * @return Array
  */
 public static function getIdNamePair()
 {
     $authors = array();
     $collection = Author::all();
     foreach ($collection as $author) {
         $authors[$author->id] = $author->name;
     }
     return $authors;
 }
开发者ID:rebekahheacock,项目名称:dwa15-archive,代码行数:16,代码来源:Author.php

示例2: index

 public function index()
 {
     $data = Author::all(['id', 'name']);
     if (Datatable::shouldHandle()) {
         return Datatable::collection($data)->showColumns('id', 'name')->addColumn('1', function ($model) {
             $html = '<a href="' . route('admin.authors.edit', $model->id) . '" class="btn btnn"> <i class="mdi-editor-mode-edit"></i> </a>';
             return $html;
         })->addColumn('2', function ($model) {
             $html = Form::open(['route' => ['admin.authors.destroy', $model->id], 'method' => 'delete']);
             $html .= '<button class="btn btnn" type="submit"> <i class="mdi-action-delete"></i> </button>';
             $html .= Form::close();
             return $html;
         })->searchColumns('name')->orderColumns('name')->make();
     }
     return View::make('authors.index')->withTitle('Penulis');
 }
开发者ID:ryanda,项目名称:larapus,代码行数:16,代码来源:AuthorsController.php

示例3: testFindWithHash

 public function testFindWithHash()
 {
     $this->assertNotNull(Author::find(array('name' => 'Tito')));
     $this->assertNotNull(Author::find('first', array('name' => 'Tito')));
     $this->assertEquals(1, count(Author::find('all', array('name' => 'Tito'))));
     $this->assertEquals(1, count(Author::all(array('name' => 'Tito'))));
 }
开发者ID:ruri,项目名称:php-activerecord-camelcased,代码行数:7,代码来源:ActiveRecordFindTest.php

示例4: test_find_with_hash

 public function test_find_with_hash()
 {
     $this->assert_not_null(Author::find(array('name' => 'Tito')));
     $this->assert_not_null(Author::find('first', array('name' => 'Tito')));
     $this->assert_equals(1, count(Author::find('all', array('name' => 'Tito'))));
     $this->assert_equals(1, count(Author::all(array('name' => 'Tito'))));
 }
开发者ID:scorplev,项目名称:php-activerecord,代码行数:7,代码来源:ActiveRecordFindTest.php

示例5: showAuthors

 public function showAuthors()
 {
     $data = Author::all();
     $this->throwError($data);
     return Response::json($data);
 }
开发者ID:sukhpalsingh,项目名称:gurbanidb,代码行数:6,代码来源:HomeController.php

示例6: index

function index()
{
    global $twig;
    $authors = new Author();
    echo $twig->render('author_list.html', array('authors' => $authors->all()));
}
开发者ID:rfloriano,项目名称:rfloriano-treichel-bookstore,代码行数:6,代码来源:authors.php

示例7: editUser

 public function editUser($id = null)
 {
     if (Input::has('submit')) {
         $id = Input::get('id');
         $rules = array('password' => 'required', 'password2' => 'required|same:password', 'role' => 'required');
         $validator = Validator::make(Input::all(), $rules);
         if ($validator->passes()) {
             $user = User::find($id);
             $user->password = Hash::make(Input::get('password'));
             $user->idauthor = Input::get('author');
             $user->role = Input::get('role');
             $user->save();
             return Redirect::to('admin/eduser/' . $id)->with('sukses', 'Ubah data User berhasil!');
         } else {
             return Redirect::to('admin/eduser/' . $id)->withErrors($validator)->withInput();
         }
     } else {
         $user = User::find($id);
         $act = 'edit';
         $tmp = Author::all();
         $authors = array();
         $authors[0] = '-- PILIH AUTHOR --';
         foreach ($tmp as $value) {
             $authors[$value->id] = $value->authorname;
         }
         $role = array(1 => 'admin', 2 => 'contributor', 3 => 'viewer');
         return View::make('admin.user', compact('user', 'act', 'authors', 'role'));
     }
 }
开发者ID:beruxganteng,项目名称:repository-djpbn,代码行数:29,代码来源:BackendController.php

示例8: index

 /**
  * Get all Authors
  *
  * return array {@type Author}
  *
  * @view authorView
  *
  */
 public function index()
 {
     return Author::all();
 }
开发者ID:Alim-ifresco,项目名称:project1.dev4.why.sr,代码行数:12,代码来源:Authors.php


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