| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | public function __construct(Post $post) |
||
| 13 | { |
||
| 14 | parent::__construct($post); |
||
| 15 | |||
| 16 | $this->published_at = $this->model->exists |
||
|
|
|||
| 17 | ? $this->model->published_at->format('Y-m-d\TH:i') |
||
| 18 | : Carbon::now()->format('Y-m-d\TH:i'); |
||
| 19 | |||
| 20 | $this->categories = Category::select('id', 'name')->pluck('name', 'id'); |
||
| 21 | |||
| 22 | $this->currentTags = $this->model->tags->pluck('name'); |
||
| 23 | |||
| 24 | $this->tags = Tag::orderBy('name')->pluck('name'); |
||
| 25 | } |
||
| 26 | |||
| 48 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: