当前位置: 首页>>代码示例>>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;未经允许,请勿转载。