Btw what is your laravel version?

|
MonkeyDFeussom 2020-09-10 18:22:58
itsvahid_ab 2020-09-10 18:21:19
well it says that you have have to enable CORS in laravel. there’s a package that you can install to solve it

Which one

itsvahid_ab 2020-09-10 18:25:44
MonkeyDFeussom 2020-09-10 18:22:58
Which one

for example this one:
https://github.com/fruitcake/laravel-cors

GitHub – fruitcake/laravel-cors: Adds CORS (Cross-Origin Resource Sharing) headers support in your Laravel applicationGitHub
Adds CORS (Cross-Origin Resource Sharing) headers support in your Laravel application – GitHub – fruitcake/laravel-cors: Adds CORS (Cross-Origin Resource Sharing) headers support in your Laravel ap…
itsvahid_ab 2020-09-10 18:26:00
MonkeyDFeussom 2020-09-10 18:22:58
Which one

btw what is your laravel version?

MonkeyDFeussom 2020-09-10 18:26:42
itsvahid_ab 2020-09-10 18:26:00
btw what is your laravel version?

Latest

Balaumamaheshwar 2020-09-10 18:27:23
Hii everyone .. looking for larvel developer to configure project in one domain (server) at remote system (TeamViewer) .. .. those are interested .. can please dm me for more details .. amount would be paid ..
itsvahid_ab 2020-09-10 18:29:40
MonkeyDFeussom 2020-09-10 18:26:42
Latest

from laravel 7 and above you should have cors enabled by default. you can check to see if you have cors.php file in your /config directory

Bhuvi100 2020-09-10 19:03:58
MonkeyDFeussom 2020-09-10 18:26:42
Latest

Add a header named Access-Control-Allow-Origin and value *

heisenberg0123 2020-09-10 19:04:02
Is it okay to put my admin pages and front end page on nuxt.js at the same time? is it safe? can a hacker access my admin pages when its on my nuxt.js static?
Bhuvi100 2020-09-10 19:04:19
This means all sites can access your api
Bhuvi100 2020-09-10 19:05:03
If u need to restrict the access,add the sites you want to access the api in the value field of that header
heisenberg0123 2020-09-10 19:05:34
I see
heisenberg0123 2020-09-10 19:05:45
I’m kinda newbie in this thing, sorry for total noob question
MonkeyDFeussom 2020-09-10 19:07:24
Bhuvi100 2020-09-10 19:03:58
Add a header named Access-Control-Allow-Origin and value *

Already

MonkeyDFeussom 2020-09-10 19:07:35
In a middleware
Bhuvi100 2020-09-10 19:08:25
MonkeyDFeussom 2020-09-10 19:07:24
Already

Then it should work

Bhuvi100 2020-09-10 19:09:11
Have you implemented that middleware properly to route or that controller?
2020-09-10 19:12:11
hi there, anyone could help me out? Im trying to add simple user registration but I think something is wrong with my routes because clicking the submit button returns 404
Route::get(‘/register’, [RegistrationController::class, ‘create’]);
Route::post(‘/register’, [RegistrationController::class, ‘store’]);
2020-09-10 19:12:54
laravel_discuss-50479.jpg
and this is my form :
2020-09-10 19:14:58
laravel_discuss-50480.jpg
and the controller in question
MonkeyDFeussom 2020-09-10 19:21:55
2020-09-10 19:12:11
hi there, anyone could help me out? Im trying to add simple user registration but I think something is wrong with my routes because clicking the submit button returns 404
Route::get(‘/register’, [RegistrationController::class, ‘create’]);
Route::post(‘/register’, [RegistrationController::class, ‘store’]);

PLease where are your routes?

2020-09-10 19:22:45
MonkeyDFeussom 2020-09-10 19:21:55
PLease where are your routes?

routes/web.php

MonkeyDFeussom 2020-09-10 19:23:22
2020-09-10 19:22:45
routes/web.php

Yeah but show us how you declared them please

MonkeyDFeussom 2020-09-10 19:23:46
Its sometimes very helpful to assign to them a name which will be used in the action of the Form
MonkeyDFeussom 2020-09-10 19:23:59
So please can u show us your route section
2020-09-10 19:24:08
laravel_discuss-50486.jpg

2020-09-10 19:25:24
im using some tutorial which was written for previous versions of laravel and the syntax in there is something like Route::post(‘register’, ‘RegistrationController@store’);
MonkeyDFeussom 2020-09-10 19:26:04
2020-09-10 19:24:08

Route::post(‘register’, ‘RegistrationController@store’); insted of the one u are using

2020-09-10 19:27:07
well the syntax works for displaying the form, though
MonkeyDFeussom 2020-09-10 19:27:23
2020-09-10 19:27:07
well the syntax works for displaying the form, though

It will work as the form action

MonkeyDFeussom 2020-09-10 19:27:58
2020-09-10 19:14:58
and the controller in question

the post method now execute the store function which calls a redirection back no matter what

MonkeyDFeussom 2020-09-10 19:28:08
Cause thats what u return
MonkeyDFeussom 2020-09-10 19:28:27
Dont do that
2020-09-10 19:28:52
sorry!
MonkeyDFeussom 2020-09-10 19:29:04
2020-09-10 19:14:58
and the controller in question

Change your return statement to let say “Action called” And the result of your form submission will be different

2020-09-10 19:35:32
changed the return back to index and tried to use syntax you suggested
2020-09-10 19:35:42
still giving me 404
2020-09-10 19:36:43
I think the POST doesnt reach the controller at all
2020-09-10 19:37:04
otherwise I would get laravel console instead of plain 404 page
MonkeyDFeussom 2020-09-10 19:37:15
2020-09-10 19:36:43
I think the POST doesnt reach the controller at all

Wait

MonkeyDFeussom 2020-09-10 19:37:38
THats strange pretty strange actually
2020-09-10 19:38:08
I think I should try to name the routes
2020-09-10 19:38:18
maybe this would help
MonkeyDFeussom 2020-09-10 19:38:38
Use
MonkeyDFeussom 2020-09-10 19:38:48
the naming of routes
MonkeyDFeussom 2020-09-10 19:39:41
{{route(‘register’)}}

Use this in the action

MonkeyDFeussom 2020-09-10 19:40:21
Route::post(‘register’, ‘RegistrationController@store’)->name(‘register’);
MonkeyDFeussom 2020-09-10 19:40:32
And use this as the route rename it
2020-09-10 19:43:10
laravel_discuss-50511.jpg
like that?
Bhuvi100 2020-09-10 19:45:24
2020-09-10 19:43:10
like that?

Yep

Bhuvi100 2020-09-10 19:45:35
MonkeyDFeussom 2020-09-10 19:40:21
Route::post(‘register’, ‘RegistrationController@store’)->name(‘register’);

Add this to your route

|