Code Duplication    Length = 7-7 lines in 6 locations

app/Device.php 1 location

@@ 247-253 (lines=7) @@
244
     *
245
     * @return string
246
     */
247
    public function getCreatedAtHumanAttribute()
248
    {
249
        if ($this->created_at->diffInDays() > 0)
250
            return $this->created_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a');
251
        else
252
            return $this->created_at->diffForHumans();
253
    }
254
    
255
    /**
256
     * Scope a query to only include devices belonging to a given location

app/Location.php 1 location

@@ 108-114 (lines=7) @@
105
     *
106
     * @return string
107
     */
108
    public function getCreatedAtHumanAttribute()
109
    {
110
        if ($this->created_at->diffInDays() > 0)
111
            return $this->created_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a');
112
        else
113
            return $this->created_at->diffForHumans();
114
    }
115
}
116

app/Sensor.php 1 location

@@ 164-170 (lines=7) @@
161
     *
162
     * @return string
163
     */
164
    public function getCreatedAtHumanAttribute()
165
    {
166
        if ($this->created_at->diffInDays() > 0)
167
            return $this->created_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a');
168
        else
169
            return $this->created_at->diffForHumans();
170
    }
171
}

app/SensorData.php 1 location

@@ 86-92 (lines=7) @@
83
     *
84
     * @return string
85
     */
86
    public function getCreatedAtHumanAttribute()
87
    {
88
        if ($this->created_at->diffInDays() > 0)
89
            return $this->created_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a');
90
        else
91
            return $this->created_at->diffForHumans();
92
    }
93
}

app/Site.php 1 location

@@ 96-102 (lines=7) @@
93
     *
94
     * @return string
95
     */
96
    public function getCreatedAtHumanAttribute()
97
    {
98
        if ($this->created_at->diffInDays() > 0)
99
            return $this->created_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a');
100
        else
101
            return $this->created_at->diffForHumans();
102
    }
103
}
104

app/User.php 1 location

@@ 183-189 (lines=7) @@
180
     *
181
     * @return string
182
     */
183
    public function getCreatedAtHumanAttribute()
184
    {
185
        if ($this->created_at->diffInDays() > 0)
186
            return $this->created_at->setTimezone($this->timezone)->format('M d, Y h:i a');
187
        else
188
            return $this->created_at->diffForHumans();
189
    }
190
}
191