There is an ijma ( consensus) of this ummah that prophet was bestowed with the knowledge of the unseen.
The proof for this is based from Quran and Sunnah.
He discloses not His unseen (ghayb) to anyone, except only to such a Messenger as He is well-pleased with.” (72:26)
Al-Hafiz Ibn Hajar al-`Asqalani explained this verse thus:
It follows from this verse that Prophets can see some of the Unseen, and so do the saints (wali, pl. awliya’) that follow each particular Prophet also, as each takes from his Prophet and is gifted (yukram) with his knowledge. The difference between the two is that the Prophet looks at this knowledge through all kinds of revelation, while the saint does not look upon it except in dreams or through inspiration, and Allah knows best
(Fath al-Bari, Tafsir Surat Luqman, ayat: “Allah has knowledge of the Hour.” (1989 ed. 8:660).
Ibn Hajar quotes al-Qurtubi’s words confirming this:
The truthful, righteous Muslim (al-muslim al-sadiq al-salih) is he whose state matches that of Prophets and thereby is bestowed (ukrima) some of the same kind of gift they were, and that is to behold the unseen (wa huwa al-ittila` `ala al-ghayb). As for the disbeliever (al-kafir), the corrupt person (al-fasiq), and the contentious one who confuses matters for the listeners (al-mikhlat)— then no
(al-Qurtubi as quoted by Ibn Hajar in Fath al-Bari (1989 ed.) 12:449.)
Usool [ Rule] in Hanafi fiqh Rule 1. To accept and believe in entire Quran. To have iman , it is necessary that one must accept the entire quran and denial of even single verse will make a person kafir.
Rule 2. When two verses are apparently contradicting each each other , that is , one verse is affirming something ( shay) and other is negating it , then the rule of ‘ Tabteeq” will be applied and the first rule of “tabteeq” is that , the affimation [ of the affirming verse]and negation [ of the negating verse] will be taken on their first meaning/ dahir [ muhmul].
[ Nurul anwar , Kitab al Usool]
[ Explaination: It means if we take two verses (which are apparently contradicting each other ) on their dhahir meaning, WITHOUT tatbeeq ,it will then make us conclude that the other verse is wrong . This will then lead to Kufr. Hence rule of tatbeeq is applied] Keep these rules in mind; we will now analyze those verses of the quran which deal with the knowledge of the prophet.
1. Say: “I have no power over any good or harm to myself except as Allah willeth. If I had knowledge of the unseen, I should have multiplied all good, and no evil should have touched me: I am but a warner, and a bringer of glad tidings to those who have faith.” (7:188)
2 Say: None in the heavens or on earth, except Allah, knows what is hidden: nor can they perceive when they shall be raised up (for Judgment).( 27: 65)
3 He (alone) knows the Unseen, nor does He make any one acquainted with His Mysteries, “Except an apostle whom He has chosen: and then He makes a band of watchers march before him and behind him. ( 72: 26-27)
4 Allah will not leave the believers in the state in which ye are now, until He separates what is evil from what is good nor will He disclose to you the secrets of the Unseen. But He chooses of His Messenger. (For the purpose) whom He pleases. So believe in Allah. And His apostles: And if ye believe and do right, ye have a reward without measure. ( 3: 179)
5 Neither doth he withhold grudgingly a knowledge of the Unseen. ( 81:24)
6 But for the Grace of Allah to thee and his Mercy, a party of them would certainly have plotted to lead thee astray. But (in fact) they will only Lead their own souls astray, and to thee they can do no harm in the least. For Allah hath sent down to thee the Book and wisdom and taught thee what thou Knewest not (before): And great is the Grace of Allah unto thee. ( 4: 113)
7 This is part of the tidings of the things unseen, which We reveal unto thee (O Messenger.) by inspiration: Thou wast not with them when they cast lots with arrows, as to which of them should be charged with the care of Mary: Nor wast thou with them when they disputed (the point). ( 3: 44)
8 Such is one of the stories of what happened unseen, which We reveal by inspiration unto thee; nor wast thou (present) with them then when they concerted their plans together in the process of weaving their plots. ( 12: 102)
9 Such are some of the stories of the unseen, which We have revealed unto thee: before this, neither thou nor thy people knew them. So persevere patiently: for the End is for those who are righteous. ( 11: 49)
Out of these nine verses the first two verses given an apparent meaning of negation with regard to the knowledge of the prophet(s), but the remaining seven affirm the knowledge of the unseen for the prophet(s).
From rule (1) quoted above it is necessary to believe in all these verses .Denial of any one verse will make a person kafir.
If we take the first two verse only ( denying remaining seven) and categorically deny the prophetic knowledge of the unseen , then it is Kufr.
Similarly if some one establishes the prophetic knowledge of the unseen in all condition and does not agree to the first two verse , he also commits kufr.
Therefore now we have to use the usool of tabteeq (as mentioned in rule number 2) to believe and accept all the verses.
The first two verses negate the knowledge of the unseen which is dhati( self) and istiqlali.( independent) .
The remaining seven verses affirms the knowledge of the unseen which is partial (juz’i), non-exhaustive (ghayr ihati), bestowed (`ata’i) and not independent (ghayr istiqlali) as established once and for all by the Qur’anic verse {the knower of the Unseen, and He reveals unto none His secret save unto every messenger whom He has chosen} (72:26-27). Using this usool , it can now be easily understood that prophet did not have dhati ( self ) knowledge but the knowledge of the unseen was bestowed upon him.
Proof that the first twq verses talk about self ( dhati) knowledge.I
t says
“Say: “I have no power over any good or harm to myself except as Allah willeth. If I had knowledge of the unseen, I should have multiplied all good, and no evil should have touched me”
Multiplication of good and staying away from evil is applicable for the knowledge which is dhati and istiqlali. ( self and independent). It is Allah alone whose knowledge is self and independent .
The second verse
“None in the heavens or on earth, except Allah, knows what is hidden: nor can they perceive when they shall be raised up”
This verse negates the knowledge of unseen for every creation and affirms the knowledge of unseen for Allah. So that knowledge of the unseen which has been negated for creation has been affirmed for Allah and we know the knowledge of Allah is dhati ( self) and istiqlali ( independent).
Hence what has been negated here is the knowledge which is dhati( self) and istiqlali ( independent).
On the other hand if we say that negation is of bestowed and independent knowledge ( atai, ghayr istiqlali) , then the same knowledge is affirmed for Allah. That means Allah will be affirmed with that knowledge on which He is dependent and which is bestowed upon Him , which is batil and muhaal ( impossible) for Allah.
Hence we will have to agree that negation is of independent ,self and non-exhaustive knowledge .
Some of the deviants have denied the knowledge of the unseen for prophet and few scholars who support these deviants write:
“ These scholars say he had only limitary knowledge of it” This is a mistake, because these deviants denied the knowledge in totality and went ahead to say that those who affirm are mushrik!
We seek refuge in Allah from these deviants . Amin