ReflectionException, class does not exist
Giving the next code I'm getting this error when I try to post to register:
ReflectionException in Route.php line 286: Class
AppHttpRequestsApiRegisterRequest does not exist
Routes
Route::group(['prefix' => 'api/v1'], function() {
Route::post('login', 'APIApiController@authenticate');
Route::post('register', 'APIApiController@register');
});
ApiController
namespace AppHttpControllersAPI;
use AppHttpControllersController;
class ApiController extends Controller
{
public function register(AppHttpRequestsApiRegisterRequest $request)
{
dd($request);
}
}
ApiRegisterRequest
namespace AppHttpRequests;
use AppHttpRequestsRequest;
class ApiRegisterRequest extends Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'first_name' => 'required:min:3',
'email' => 'required'
];
}
public function messages()
{
$messages = [
'first_name.required' => 'Has de introducir un nombre'
'email.required' => 'Has de introducir un correo'
];
return $messages;
}
}
What am I doing wrong?
php laravel reflection namespaces laravel-5.2
add a comment |
Giving the next code I'm getting this error when I try to post to register:
ReflectionException in Route.php line 286: Class
AppHttpRequestsApiRegisterRequest does not exist
Routes
Route::group(['prefix' => 'api/v1'], function() {
Route::post('login', 'APIApiController@authenticate');
Route::post('register', 'APIApiController@register');
});
ApiController
namespace AppHttpControllersAPI;
use AppHttpControllersController;
class ApiController extends Controller
{
public function register(AppHttpRequestsApiRegisterRequest $request)
{
dd($request);
}
}
ApiRegisterRequest
namespace AppHttpRequests;
use AppHttpRequestsRequest;
class ApiRegisterRequest extends Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'first_name' => 'required:min:3',
'email' => 'required'
];
}
public function messages()
{
$messages = [
'first_name.required' => 'Has de introducir un nombre'
'email.required' => 'Has de introducir un correo'
];
return $messages;
}
}
What am I doing wrong?
php laravel reflection namespaces laravel-5.2
Where is Route.php code? In route section wrong segment, becouse in don't consist ApiRegisterRequest.
– Lakremon
Aug 2 '16 at 10:10
In your composer did you have a "psr-4" autoload, if not try to dophp artisan dump-autoload
– Maraboc
Aug 2 '16 at 10:17
"psr-4": { "App\": "app/" }, I did the dump-autoload before but didn't work
– suarsenegger
Aug 2 '16 at 10:20
Maybe I've overlooked it, but if not, can you tell us where your line 268 is?
– Andrej
Aug 2 '16 at 11:12
add a comment |
Giving the next code I'm getting this error when I try to post to register:
ReflectionException in Route.php line 286: Class
AppHttpRequestsApiRegisterRequest does not exist
Routes
Route::group(['prefix' => 'api/v1'], function() {
Route::post('login', 'APIApiController@authenticate');
Route::post('register', 'APIApiController@register');
});
ApiController
namespace AppHttpControllersAPI;
use AppHttpControllersController;
class ApiController extends Controller
{
public function register(AppHttpRequestsApiRegisterRequest $request)
{
dd($request);
}
}
ApiRegisterRequest
namespace AppHttpRequests;
use AppHttpRequestsRequest;
class ApiRegisterRequest extends Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'first_name' => 'required:min:3',
'email' => 'required'
];
}
public function messages()
{
$messages = [
'first_name.required' => 'Has de introducir un nombre'
'email.required' => 'Has de introducir un correo'
];
return $messages;
}
}
What am I doing wrong?
php laravel reflection namespaces laravel-5.2
Giving the next code I'm getting this error when I try to post to register:
ReflectionException in Route.php line 286: Class
AppHttpRequestsApiRegisterRequest does not exist
Routes
Route::group(['prefix' => 'api/v1'], function() {
Route::post('login', 'APIApiController@authenticate');
Route::post('register', 'APIApiController@register');
});
ApiController
namespace AppHttpControllersAPI;
use AppHttpControllersController;
class ApiController extends Controller
{
public function register(AppHttpRequestsApiRegisterRequest $request)
{
dd($request);
}
}
ApiRegisterRequest
namespace AppHttpRequests;
use AppHttpRequestsRequest;
class ApiRegisterRequest extends Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'first_name' => 'required:min:3',
'email' => 'required'
];
}
public function messages()
{
$messages = [
'first_name.required' => 'Has de introducir un nombre'
'email.required' => 'Has de introducir un correo'
];
return $messages;
}
}
What am I doing wrong?
php laravel reflection namespaces laravel-5.2
php laravel reflection namespaces laravel-5.2
edited Aug 2 '16 at 10:19
suarsenegger
asked Aug 2 '16 at 10:05
suarseneggersuarsenegger
4881717
4881717
Where is Route.php code? In route section wrong segment, becouse in don't consist ApiRegisterRequest.
– Lakremon
Aug 2 '16 at 10:10
In your composer did you have a "psr-4" autoload, if not try to dophp artisan dump-autoload
– Maraboc
Aug 2 '16 at 10:17
"psr-4": { "App\": "app/" }, I did the dump-autoload before but didn't work
– suarsenegger
Aug 2 '16 at 10:20
Maybe I've overlooked it, but if not, can you tell us where your line 268 is?
– Andrej
Aug 2 '16 at 11:12
add a comment |
Where is Route.php code? In route section wrong segment, becouse in don't consist ApiRegisterRequest.
– Lakremon
Aug 2 '16 at 10:10
In your composer did you have a "psr-4" autoload, if not try to dophp artisan dump-autoload
– Maraboc
Aug 2 '16 at 10:17
"psr-4": { "App\": "app/" }, I did the dump-autoload before but didn't work
– suarsenegger
Aug 2 '16 at 10:20
Maybe I've overlooked it, but if not, can you tell us where your line 268 is?
– Andrej
Aug 2 '16 at 11:12
Where is Route.php code? In route section wrong segment, becouse in don't consist ApiRegisterRequest.
– Lakremon
Aug 2 '16 at 10:10
Where is Route.php code? In route section wrong segment, becouse in don't consist ApiRegisterRequest.
– Lakremon
Aug 2 '16 at 10:10
In your composer did you have a "psr-4" autoload, if not try to do
php artisan dump-autoload
– Maraboc
Aug 2 '16 at 10:17
In your composer did you have a "psr-4" autoload, if not try to do
php artisan dump-autoload
– Maraboc
Aug 2 '16 at 10:17
"psr-4": { "App\": "app/" }, I did the dump-autoload before but didn't work
– suarsenegger
Aug 2 '16 at 10:20
"psr-4": { "App\": "app/" }, I did the dump-autoload before but didn't work
– suarsenegger
Aug 2 '16 at 10:20
Maybe I've overlooked it, but if not, can you tell us where your line 268 is?
– Andrej
Aug 2 '16 at 11:12
Maybe I've overlooked it, but if not, can you tell us where your line 268 is?
– Andrej
Aug 2 '16 at 11:12
add a comment |
1 Answer
1
active
oldest
votes
The Error is caused because you have a syntax error in ApiRegisterRequest.
$messages = [
'first_name.required' => 'Has de introducir un nombre'
'email.required' => 'Has de introducir un correo'
];
You have missed the colon at the end of the first entryo of $messages array.
Replace your messages by this:
$messages = [
'first_name.required' => 'Has de introducir un nombre',
'email.required' => 'Has de introducir un correo'
];
This should do the trick
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f38717456%2freflectionexception-class-does-not-exist%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The Error is caused because you have a syntax error in ApiRegisterRequest.
$messages = [
'first_name.required' => 'Has de introducir un nombre'
'email.required' => 'Has de introducir un correo'
];
You have missed the colon at the end of the first entryo of $messages array.
Replace your messages by this:
$messages = [
'first_name.required' => 'Has de introducir un nombre',
'email.required' => 'Has de introducir un correo'
];
This should do the trick
add a comment |
The Error is caused because you have a syntax error in ApiRegisterRequest.
$messages = [
'first_name.required' => 'Has de introducir un nombre'
'email.required' => 'Has de introducir un correo'
];
You have missed the colon at the end of the first entryo of $messages array.
Replace your messages by this:
$messages = [
'first_name.required' => 'Has de introducir un nombre',
'email.required' => 'Has de introducir un correo'
];
This should do the trick
add a comment |
The Error is caused because you have a syntax error in ApiRegisterRequest.
$messages = [
'first_name.required' => 'Has de introducir un nombre'
'email.required' => 'Has de introducir un correo'
];
You have missed the colon at the end of the first entryo of $messages array.
Replace your messages by this:
$messages = [
'first_name.required' => 'Has de introducir un nombre',
'email.required' => 'Has de introducir un correo'
];
This should do the trick
The Error is caused because you have a syntax error in ApiRegisterRequest.
$messages = [
'first_name.required' => 'Has de introducir un nombre'
'email.required' => 'Has de introducir un correo'
];
You have missed the colon at the end of the first entryo of $messages array.
Replace your messages by this:
$messages = [
'first_name.required' => 'Has de introducir un nombre',
'email.required' => 'Has de introducir un correo'
];
This should do the trick
answered Aug 2 '16 at 11:35
shock_gone_wildshock_gone_wild
4,66431739
4,66431739
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f38717456%2freflectionexception-class-does-not-exist%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Where is Route.php code? In route section wrong segment, becouse in don't consist ApiRegisterRequest.
– Lakremon
Aug 2 '16 at 10:10
In your composer did you have a "psr-4" autoload, if not try to do
php artisan dump-autoload
– Maraboc
Aug 2 '16 at 10:17
"psr-4": { "App\": "app/" }, I did the dump-autoload before but didn't work
– suarsenegger
Aug 2 '16 at 10:20
Maybe I've overlooked it, but if not, can you tell us where your line 268 is?
– Andrej
Aug 2 '16 at 11:12