當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。