Saturday, 15 August 2015

php - laravel create request not working -


You can probably look very new to Larval.

  to create php artisan :  

CreateSongRequest

, in return for which an CreateSongRequest.php file was generated in app / http / requests

content. .

  & lt ;? Php namespace app \ hpt \ request; Use the application \ hpp \ requests \ request; The square increases the CreateSongRequest request {/ ** * Determine that the user is authorized to perform this request. * * @ Return Boole * / Authorize Public Function () {Back to Truth; } / ** * Obtain the verification rules that apply to the request. * * Returns array * / Public Function Rule () {Returns [//]; }}  

In my controller I have posted the form for the following method ...

  Public Function Store (CreateSongRequest $ request, Song $ song ) {$ Song- & gt; Create ($ Request-> All ()); Return Redirect () - & gt; Route ('songs_path'); }  

When I submit the form, I get the following error ...

RouteDependencyResolverTrait.php line of reflection options 53: Class app \ hpt \ Controllers \ CreateSongRequest

You have to add it to the top of your controller:

 Use the  app \ htp \ requests \ CreateSongRequest;  

No comments:

Post a Comment