You can use whereColumn
method to compare the values of two columns.
return Task::whereColumn('created_at', 'updated_at')->get();// pass a comparison operatorreturn Task::whereColumn('created_at', '>', 'updated_at')->get();
Tip given by @iamgurmandeep