Conditions | 4 |
Paths | 7 |
Total Lines | 22 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
41 | public function handle() |
||
42 | { |
||
43 | try { |
||
44 | $articles = Article::all(); |
||
45 | |||
46 | $headers = ['id', 'Title','Description', 'Read', 'User id', 'User Name']; |
||
47 | $fields = []; |
||
48 | foreach ($articles as $article) { |
||
49 | $fields[] = [ |
||
50 | 'id:' => $article->id, |
||
51 | 'Title:' => $article->title, |
||
52 | 'Description:' => $article->description, |
||
53 | 'Read:' => $article->read ? 'Yes' : 'No', |
||
54 | 'User id:' => $article->user_id, |
||
55 | 'User name:' => User::findOrFail($article->user_id)->name, |
||
56 | ]; |
||
57 | } |
||
58 | } catch (Exception $e) { |
||
59 | $this->error('Error'); |
||
60 | } |
||
61 | $this->table($headers, $fields); |
||
62 | } |
||
63 | } |
||
64 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.