laravel/slack-notification-channel

Not possible to use "Date" as the name of a field

WouterFlorijn opened this issue · 1 comments

Very simple issue to describe. The SlackAttachment@field method checks if the $title is callable using is_callable. If you use 'Date' as a field name (or any other name of a global function), it'll be used as a function instead of a string. Example:

$attachment->field('Date', $someDate);

Leads to

date() expects parameter 1 to be string, object given

is_callable is not a good way to overload the method, and it should be changed. For example, using an extra boolean parameter to indicate the first argument should be used as a callable.

Please fill out the issue template.