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


PHP Article::first方法代码示例

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


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

示例1: testNeedToBeAuthPages

 public function testNeedToBeAuthPages()
 {
     factory(\App\Models\Article::class)->create();
     $article = \App\Models\Article::first();
     $this->get('/admin/article/create')->assertResponseStatus(302);
     $this->get('/admin/article/' . $article->getKey() . '/edit')->assertResponseStatus(302);
 }
开发者ID:mattvb91,项目名称:website-laravel,代码行数:7,代码来源:AuthTest.php

示例2: it_creates_an_article

 /** @test */
 public function it_creates_an_article()
 {
     $user = factory(App\Models\User::class)->create();
     $this->actingAs($user)->visit('articles/create')->type('Dummy Title', 'title')->type('Dummy Body', 'article')->click('Publish');
     $this->seeInDatabase('articles', ['title' => 'Dummy Title', 'slug' => 'dummy-title', 'published' => true, 'author_id' => $user->id]);
     $article = Article::first();
     $file = "{$article->path}/{$article->file}";
     $this->assertTrue($this->app['files']->exists($file));
     $this->app['files']->delete($file);
 }
开发者ID:kishanterry,项目名称:emdlog,代码行数:11,代码来源:ArticlesTest.php

示例3: testShow

 public function testShow()
 {
     $article = Article::first();
     $this->get('/article/' . $article->slug)->seeStatusCode(200)->see($article->getTitle());
 }
开发者ID:mattvb91,项目名称:website-laravel,代码行数:5,代码来源:ArticleTest.php

示例4: article

 public function article()
 {
     $this->view = View::make('home.article')->with(['article' => Article::first(), 'title' => 'haha', 'fuck_me' => 'fuck me!'])->withFuckMe('fuck you');
     //var_dump($this->view);
     View::render($this->view);
 }
开发者ID:kimmykuang,项目名称:MFFBC,代码行数:6,代码来源:HomeController.php

示例5: home

 public function home()
 {
     View::make('welcome')->with('article', Article::first())->withTitle('Title')->withFine('我很棒')->withEricFzy('I`m Eric.fzy"');
 }
开发者ID:104260033,项目名称:simple,代码行数:4,代码来源:WelcomeController.php

示例6: testGetUser

 public function testGetUser()
 {
     factory(Article::class)->create();
     $article = Article::first();
     $this->assertInstanceOf(\App\Models\User::class, $article->user);
 }
开发者ID:mattvb91,项目名称:website-laravel,代码行数:6,代码来源:ArticleTest.php


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