本文整理汇总了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);
}
示例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);
}
示例3: testShow
public function testShow()
{
$article = Article::first();
$this->get('/article/' . $article->slug)->seeStatusCode(200)->see($article->getTitle());
}
示例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);
}
示例5: home
public function home()
{
View::make('welcome')->with('article', Article::first())->withTitle('Title')->withFine('我很棒')->withEricFzy('I`m Eric.fzy"');
}
示例6: testGetUser
public function testGetUser()
{
factory(Article::class)->create();
$article = Article::first();
$this->assertInstanceOf(\App\Models\User::class, $article->user);
}