Throw ModelNotFoundException when model bind not found
Throw ModelNotFoundException when model bind not found

This is a PR for Issue #13455 to bring consistency to model bind not found and findOrFail.

The NotFoundHttpException was changed to a ModelNotFoundException and has the model set, the exact same as in Eloquent/Builder findOrFail.

Although the Exceptions/Handler.php converts this back to a NotFoundHttpException in the prepareException method anyway (so thus should have same behaviour for projects using the default handling), by throwing a ModelNotFoundException in the first instance has the added benefit that a custom Handler subclass can render both cases of a model binding not found and a findOrFail in the same way. Furthermore, by having an exception that has the model name set on it, exception handling can be even more improved for binding failures, e.g. by default there is now the message "No query results for model [App\ModeClass]." instead of no message. This message is exactly the same as the exception from findOrFail since it is created inside the ModelNotFoundException itself.

Before this fix, developers had to workaround this issue by providing a closure to return the correct exception on all their route models via a closure, although in the example given in this forum post, the developer didn't set the model on the exception:
https://laracasts.com/discuss/channels/general-discussion/throw-modelnotfoundexception-using-route-model-binding
PantherDD/laravel-framework,miclf/framework,jerguslejko/framework,markhemstead/framework,reinink/framework,halaei/framework,vlakoff/framework,CurosMJ/framework,joko-wandiro/framework,BePsvPT-Fork/framework,alnutile/framework,bobbybouwmann/framework,cybercog/framework,GreenLightt/laravel-framework,ChristopheB/framework,joecohens/framework,jtgrimes/framework,cviebrock/framework,halaei/framework,ncaneldiee/laravel-framework,vlakoff/framework,barryvdh/framework,filipeaclima/framework,morrislaptop/framework,reinink/framework,irfanevrens/framework,nhowell/laravel-framework,TheGIBSON/framework,miclf/framework,spyric/framework,djtarazona/laravel-framework,mul14/laravel-framework,Belphemur/framework,pakogn/framework,tomschlick/framework,jmarcher/framework,mlantz/framework,ps92/framework,filipeaclima/framework,JamesForks/framework,behzadsh/framework,bdsoha/framework,martinbean/laravel-framework,jarnovanleeuwen/framework,behzadsh/framework,renekoch/framework,billmn/framework,guiwoda/framework,piokom123/framework,rocketpastsix/framework,olsgreen/framework,barryvdh/framework,martinbean/laravel-framework,crynobone/framework,jmarcher/framework,vetruvet/framework,leo108/laravel_framework,billmn/framework,miclf/framework,Garbee/framework,EspadaV8/framework,vetruvet/framework,markhemstead/framework,GreenLightt/laravel-framework,SebastianBerc/framework,stidges/framework,lucasmichot/laravel--framework,rodrigopedra/framework,n7olkachev/framework,bmitch/framework,tomschlick/framework,stidges/framework,mlantz/framework,hosmelq/framework,scrubmx/framework,anteriovieira/framework,mul14/laravel-framework,JosephSilber/framework,arturock/framework,laravel/framework,rodrigopedra/framework,alnutile/framework,jchamberlain/framework,Evertt/framework,cybercog/framework,ps92/framework,jerguslejko/framework,ncaneldiee/laravel-framework,SebastianBerc/framework,mlantz/framework,stevebauman/framework,martinssipenko/framework,spyric/framework,jimrubenstein/laravel-framework,scrubmx/framework,Hugome/framework,leo108/laravel_framework,jimrubenstein/laravel-framework,srmkliveforks/framework,stidges/framework,lucasmichot/framework,barryvdh/framework,bmitch/framework,nhowell/laravel-framework,jarektkaczyk/framework,gms8994/framework,PantherDD/laravel-framework,EspadaV8/framework,srmkliveforks/framework,ps92/framework,CurosMJ/framework,jarektkaczyk/framework,djtarazona/laravel-framework,Fenzland/laravel,bdsoha/framework,piokom123/framework,AllysonSilva/LaravelKernel,jarnovanleeuwen/framework,n7olkachev/framework,jerguslejko/framework,tomschlick/framework,guiwoda/framework,djtarazona/laravel-framework,hafezdivandari/framework,antonioribeiro/framework,mul14/laravel-framework,gms8994/framework,dan-har/framework,BePsvPT-Fork/framework,JosephSilber/framework,acasar/framework,dwightwatson/framework,jchamberlain/framework,crynobone/framework,Belphemur/framework,acasar/framework,rocketpastsix/framework,alepeino/framework,Evertt/framework,antonioribeiro/framework,laravel/framework,srmkliveforks/framework,reinink/framework,bmitch/framework,ChristopheB/framework,tjbp/framework,bobbybouwmann/framework,ncaneldiee/laravel-framework,srmkliveforks/framework,cybercog/framework,Garbee/framework,jchamberlain/framework,stevebauman/framework,Evertt/framework,SebastianBerc/framework,lucasmichot/laravel--framework,cviebrock/framework,notebowl/laravel-framework,PantherDD/laravel-framework,jrean/framework,cviebrock/framework,EspadaV8/framework,vetruvet/framework,hafezdivandari/framework,antonioribeiro/framework,jtgrimes/framework,GreenLightt/laravel-framework,BePsvPT-Fork/framework,piokom123/framework,BePsvPT/framework,joko-wandiro/framework,alnutile/framework,alepeino/framework,BePsvPT/framework,nhowell/laravel-framework,irfanevrens/framework,jmarcher/framework,vlakoff/framework,bytestream/framework,rodrigopedra/framework,acasar/framework,stidges/framework,scrubmx/framework,joecohens/framework,lucasmichot/laravel--framework,arturock/framework,Fenzland/laravel,renekoch/framework,cviebrock/framework,bytestream/framework,barryvdh/framework,tjbp/framework,bobbybouwmann/framework,olsgreen/framework,hosmelq/framework,driesvints/framework,martinssipenko/framework,jarektkaczyk/framework,rodrigopedra/framework,guiwoda/framework,dan-har/framework,jarnovanleeuwen/framework,TheGIBSON/framework,Garbee/framework,TheGIBSON/framework,Fenzland/laravel,jtgrimes/framework,jrean/framework,CurosMJ/framework,BePsvPT-Fork/framework,lucasmichot/framework,hosmelq/framework,OzanKurt/framework,pakogn/framework,Hugome/framework,mateusjatenee/framework,JamesForks/framework,gms8994/framework,anteriovieira/framework,olsgreen/framework,martinbean/laravel-framework,tjbp/framework,Hugome/framework,Belphemur/framework,samlev/framework,bdsoha/framework,behzadsh/framework,mul14/laravel-framework,notebowl/laravel-framework,arturock/framework,OzanKurt/framework,samlev/framework,AllysonSilva/LaravelKernel,jrean/framework,driesvints/framework,OzanKurt/framework,alepeino/framework,BePsvPT/framework,n7olkachev/framework,mateusjatenee/framework,dwightwatson/framework,joecohens/framework,pakogn/framework,renekoch/framework,jimrubenstein/laravel-framework,filipeaclima/framework,billmn/framework,AllysonSilva/LaravelKernel,irfanevrens/framework,morrislaptop/framework,mateusjatenee/framework,anteriovieira/framework,dan-har/framework,gms8994/framework,martinssipenko/framework,spyric/framework,halaei/framework,jerguslejko/framework,ChristopheB/framework