use Illuminate\Database\Eloquent\Model; class User extends Model { /** * The attributes that should be cast to dates. * * @var array */ protected $dates = [ 'created_at', 'updated_at', 'deleted_at', ]; } $user = new User; $dates = $user->getDates(); // ['created_at', 'updated_at', 'deleted_at']
use Illuminate\Database\Eloquent\Model; class Post extends Model { protected $table = 'posts'; protected $fillable = ['title', 'content', 'published_at']; protected $dates = ['published_at']; } $post = new Post; $dates = $post->getDates(); // ['published_at']This method is a part of the Laravel framework's Eloquent ORM package library.