protected function attributesThatHaveMessages()
    {
        return collect($this->messages()->toArray())->map(function ($message, $key) {
            return explode('.', $key)[0];
        })->unique()->flip()->all();
    }
protected function attributesThatHaveMessages()
    {
        return collect($this->messages()->toArray())->map(function ($message, $key) {
            return explode('.', $key)[0];
        })->unique()->flip()->all();
    }
protected function attributesThatHaveMessages ( ) { return collect ( $ this -> messages ( ) -> toArray ( ) ) -> map ( function ( $ message , $ key ) { return explode ( '.' , $ key ) [ 0 ] ; } ) -> unique ( ) -> flip ( ) -> all ( ) ; }
Generate an array of all attributes that have messages.

@return array
Generate an array of all attributes that have messages .