Code Duplication    Length = 16-16 lines in 2 locations

src/Console/Commands/Traits/AsksForArticles.php 1 location

@@ 10-25 (lines=16) @@
7
/**
8
 * Trait AsksForArticles.
9
 */
10
trait AsksForArticles
11
{
12
    /**
13
     * Ask for articles.
14
     *
15
     * @return mixed
16
     */
17
    protected function askForArticles()
18
    {
19
        $articles = Article::all();
20
        $article_titles = $articles->pluck('title')->toArray();
21
        $article_title = $this->choice('Article id?', $article_titles);
22
23
        return $articles->where('title', $article_title)->first()->id;
24
    }
25
}
26

src/Console/Commands/Traits/AsksForUsers.php 1 location

@@ 10-25 (lines=16) @@
7
/**
8
 * Trait AsksForUsers.
9
 */
10
trait AsksForUsers
11
{
12
    /**
13
     * Ask for events.
14
     *
15
     * @return mixed
16
     */
17
    public function askForUsers()
18
    {
19
        $users = User::all();
20
        $user_names = $users->pluck('name')->toArray();
21
        $user_name = $this->choice('User?', $user_names);
22
23
        return $users->where('name', $user_name)->first()->id;
24
    }
25
}
26