The "law of attraction" does function on material matter because of material gravity and on spirit substance because of spirit gravity; those are the only two real laws of attraction, but that's not what you're asking about. You want to know if you want and wish for things focused and strongly enough if they'll be granted to you, a popular new age concept along similar lines to karma, and the answer to that is no; magic does not uphold reality even as much as we may desire that would be the case.
It is always to our benefit to entertain a positive outlook even in the face of disappointment and struggle, to believe that the best is available to us if we do our best, to set goals and strive to achieve them, to direct our lives along positive lines. If that's our life's outlook then the seemingly impossible can and sometimes does become our reality. Remember the concept that "God is no respecter of persons." This means that God (or fate) does not show favoritism to those who set their minds on wants and needs as opposed to those who have no such focus. Life on an experimental evolutionary world always poses rewards and defeats – -it's your attitude toward these vicissitudes that makes the overall difference in the quality of your life.