當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Author::all方法代碼示例

本文整理匯總了PHP中app\models\Author::all方法的典型用法代碼示例。如果您正苦於以下問題:PHP Author::all方法的具體用法?PHP Author::all怎麽用?PHP Author::all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\models\Author的用法示例。


在下文中一共展示了Author::all方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testModelSeed

 /**
  * Test samples for all models have been seeded.
  */
 public function testModelSeed()
 {
     $message = 'Haven\'t you forgotten to run artisan migrate and db::seed?';
     $this->assertNotEmpty(Author::all(), $message);
     $this->assertNotEmpty(Comment::all(), $message);
     $this->assertNotEmpty(Post::all(), $message);
     $this->assertNotEmpty(Site::all(), $message);
 }
開發者ID:jonpitch,項目名稱:limoncello-collins,代碼行數:11,代碼來源:ModelsAndSeedsTest.php

示例2: testModelSeed

 /**
  * Test samples for all models have been seeded.
  */
 public function testModelSeed()
 {
     $message = 'Haven\'t you forgotten to run artisan migrate and db::seed?';
     $this->assertNotEmpty(Author::all(), $message);
     $this->assertNotEmpty(Comment::all(), $message);
     $this->assertNotEmpty(Post::all(), $message);
     $this->assertNotEmpty(Site::all(), $message);
     $isAuthenticated = Auth::attempt(['email' => UsersTableSeeder::SAMPLE_LOGIN, 'password' => UsersTableSeeder::SAMPLE_PASSWORD]);
     $this->assertTrue($isAuthenticated);
 }
開發者ID:greyexpert,項目名稱:limoncello-shot,代碼行數:13,代碼來源:ModelsAndSeedsTest.php

示例3: run

 public function run()
 {
     if (class_exists('Faker\\Factory')) {
         $faker = Faker\Factory::create();
         $specimens = Specimen::all()->all();
         $museums = Museum::all()->all();
         $authors = Author::all()->all();
         $animalGroups = AnimalGroup::all()->all();
         for ($i = 1; $i <= 500; $i++) {
             Scan::create(['scanId' => $faker->randomNumber(5), 'scanQuality' => $faker->randomElement(['low', 'medium', 'high']), 'fileDirectory' => '//scan' . $faker->randomNumber(2), 'location' => $faker->country, 'scanTime' => $faker->dateTime, 'voltage' => $faker->randomFloat(2, 1, 20), 'voxelSize' => $faker->randomFloat(1, 0, 1) . 'mm', 'imageCount' => $faker->randomNumber(4), 'current' => '120v', 'sequence' => $faker->randomNumber(4), 'specimenId' => $faker->randomElement($specimens)->id, 'museumId' => $faker->randomElement($museums)->id, 'authorId' => $faker->randomElement($authors)->id, 'animalGroupId' => $faker->randomElement($animalGroups)->id]);
         }
     }
 }
開發者ID:HackTheDinos,項目名稱:team-squiz-bone-explorer,代碼行數:13,代碼來源:ScanSeeder.php

示例4: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $this->checkParametersEmpty();
     return $this->getResponse(Author::all());
 }
開發者ID:greyexpert,項目名稱:limoncello-shot,代碼行數:10,代碼來源:AuthorsController.php

示例5: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     return $this->getResponse(Author::all());
 }
開發者ID:jonpitch,項目名稱:limoncello-collins,代碼行數:9,代碼來源:AuthorsController.php

示例6: function

// --- BOOKS ---
$app->get('/books', function () use($app) {
    $books = Book::all();
    return view('books.index', ['books' => $books]);
});
$app->get('/books/new', function (Request $request) use($app) {
    $authors = Author::all();
    return view('books.new', ['authors' => $authors, 'request' => $request]);
});
$app->post('/books', function (Request $request) use($app) {
    $this->validate($request, Book::VALIDATION_RULES);
    $new_book = new Book($request->all());
    $new_book->save();
    return redirect('books/' . $new_book->id);
});
$app->get('/books/{id}', function ($id, Request $request) use($app) {
    $book = Book::find($id);
    $authors = Author::all();
    return view('books.edit', ['authors' => $authors, 'request' => $request, 'book' => $book, 'id' => $id]);
});
$app->post('/books/{id}/update', function ($id, Request $request) use($app) {
    $this->validate($request, Book::VALIDATION_RULES);
    $book = Book::find($id);
    $book->update($request->all());
    return redirect('books/' . $book->id);
});
$app->get('authors/{id}/books', function ($id, Request $request) use($app) {
    $author = Author::find($id);
    $books = $author->books->all();
    return view('books.by_author', ['author' => $author, 'request' => $request, 'books' => $books, 'id' => $id]);
});
開發者ID:simonbacquie,項目名稱:get-started-with-lumen,代碼行數:31,代碼來源:routes.php


注:本文中的app\models\Author::all方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。