Protect routes in laravel when manually entered addressLaravel 4 - Route::resource vs Route::controller. Which to use?Laravel 4: Multi-Page Form on the same route?Password reset routing laravelLaravel manual authentication: Auth::attempt always falseRouting conflict LaravelHow to authenticate email and password with laravel 5.3 manually?404 Issue in Laravel API when required param value not passedLaravel Conditional Clause When()Laravel building manual password resetLaravel default make:auth “login” route naming

Is it expected that a reader will skip parts of what you write?

How did old MS-DOS games utilize various graphic cards?

Is a lack of character descriptions a problem?

Importance of Building Credit Score?

CROSS APPLY produces outer join

Why do some employees fill out a W-4 and some don't?

Non-aquatic eyes?

Is this use of the expression "long past" correct?

Colloquialism for “see you later”

Bent Peugeot Carbolite 103 Frame

What to do when surprise and a high initiative roll conflict with the narrative?

Generate basis elements of the Steenrod algebra

Soft question: Examples where lack of mathematical rigour cause security breaches?

Check if three arrays contains the same element

Using "subway" as name for London Underground?

How do I prevent employees from either switching to competitors or opening their own business?

Why didn't Voldemort recognize that Dumbledore was affected by his curse?

How do governments keep track of their issued currency?

Determining fair price for profitable mobile app business

How to hide rifle during medieval town entrance inspection?

Wooden cooking layout

Why doesn't Adrian Toomes give up Spider-Man's identity?

How can I make some of my chapters "come to life"?

is it possible for a vehicle to be manufactured witout a catalitic converter



Protect routes in laravel when manually entered address


Laravel 4 - Route::resource vs Route::controller. Which to use?Laravel 4: Multi-Page Form on the same route?Password reset routing laravelLaravel manual authentication: Auth::attempt always falseRouting conflict LaravelHow to authenticate email and password with laravel 5.3 manually?404 Issue in Laravel API when required param value not passedLaravel Conditional Clause When()Laravel building manual password resetLaravel default make:auth “login” route naming






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








-1















I am studying and registering information in the database, out of curiosity I did the test to access the route of registration directly through the URL and I came across the following error "The GET method is not supported for this route. Supported methods: POST.". How can you protect me from this mistake?



route for view:



Route::get('/cadastro', 'UserController@index');


route for action do form:



Route::post('/cadastrar', 'UserController@cadastrar');


form:



<form method="post" action="url('cadastrar')">
@csrf
<input type="text" id="name" name="name" placeholder="Usuário">
<input type="email" id="email" name="email" placeholder="email">
<input type="password" id="password" name="password" placeholder="senha">
<input type="submit" value="Cadastrar">
</form>


method register for controller:



public function cadastrar(Request $request)

$validatedData = $request->validate([
'name'=>'required',
'password' =>'required'
]);
$user = new User();
$user->name = $request->input('name');
$user->email = $request->input('email');
$user->password = bcrypt($request->input('password'));
$user->save();











share|improve this question






























    -1















    I am studying and registering information in the database, out of curiosity I did the test to access the route of registration directly through the URL and I came across the following error "The GET method is not supported for this route. Supported methods: POST.". How can you protect me from this mistake?



    route for view:



    Route::get('/cadastro', 'UserController@index');


    route for action do form:



    Route::post('/cadastrar', 'UserController@cadastrar');


    form:



    <form method="post" action="url('cadastrar')">
    @csrf
    <input type="text" id="name" name="name" placeholder="Usuário">
    <input type="email" id="email" name="email" placeholder="email">
    <input type="password" id="password" name="password" placeholder="senha">
    <input type="submit" value="Cadastrar">
    </form>


    method register for controller:



    public function cadastrar(Request $request)

    $validatedData = $request->validate([
    'name'=>'required',
    'password' =>'required'
    ]);
    $user = new User();
    $user->name = $request->input('name');
    $user->email = $request->input('email');
    $user->password = bcrypt($request->input('password'));
    $user->save();











    share|improve this question


























      -1












      -1








      -1








      I am studying and registering information in the database, out of curiosity I did the test to access the route of registration directly through the URL and I came across the following error "The GET method is not supported for this route. Supported methods: POST.". How can you protect me from this mistake?



      route for view:



      Route::get('/cadastro', 'UserController@index');


      route for action do form:



      Route::post('/cadastrar', 'UserController@cadastrar');


      form:



      <form method="post" action="url('cadastrar')">
      @csrf
      <input type="text" id="name" name="name" placeholder="Usuário">
      <input type="email" id="email" name="email" placeholder="email">
      <input type="password" id="password" name="password" placeholder="senha">
      <input type="submit" value="Cadastrar">
      </form>


      method register for controller:



      public function cadastrar(Request $request)

      $validatedData = $request->validate([
      'name'=>'required',
      'password' =>'required'
      ]);
      $user = new User();
      $user->name = $request->input('name');
      $user->email = $request->input('email');
      $user->password = bcrypt($request->input('password'));
      $user->save();











      share|improve this question
















      I am studying and registering information in the database, out of curiosity I did the test to access the route of registration directly through the URL and I came across the following error "The GET method is not supported for this route. Supported methods: POST.". How can you protect me from this mistake?



      route for view:



      Route::get('/cadastro', 'UserController@index');


      route for action do form:



      Route::post('/cadastrar', 'UserController@cadastrar');


      form:



      <form method="post" action="url('cadastrar')">
      @csrf
      <input type="text" id="name" name="name" placeholder="Usuário">
      <input type="email" id="email" name="email" placeholder="email">
      <input type="password" id="password" name="password" placeholder="senha">
      <input type="submit" value="Cadastrar">
      </form>


      method register for controller:



      public function cadastrar(Request $request)

      $validatedData = $request->validate([
      'name'=>'required',
      'password' =>'required'
      ]);
      $user = new User();
      $user->name = $request->input('name');
      $user->email = $request->input('email');
      $user->password = bcrypt($request->input('password'));
      $user->save();








      php laravel






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 24 at 18:34







      Ermeson Oliveira

















      asked Mar 24 at 18:28









      Ermeson OliveiraErmeson Oliveira

      11




      11






















          1 Answer
          1






          active

          oldest

          votes


















          0














          In your form, change the action to action="route('nameOfRoute')"



          And just name your route like usual.
          You can also make a Route::resource() to make things more clean and standard.






          share|improve this answer























          • erro: Route [cadastrar] not defined. But it's

            – Ermeson Oliveira
            Mar 24 at 18:43











          • Did you name the route in the web.php file?

            – GabMic
            Mar 24 at 18:48











          • Route::post('/cadastrar', 'UserController@cadastrar');

            – Ermeson Oliveira
            Mar 24 at 18:51











          • You haven't named it. Do it like so: Route::post('/cadastrar', 'UserController@cadastrar')->name('nameOfRoute');

            – GabMic
            Mar 24 at 19:19












          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
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55327089%2fprotect-routes-in-laravel-when-manually-entered-address%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









          0














          In your form, change the action to action="route('nameOfRoute')"



          And just name your route like usual.
          You can also make a Route::resource() to make things more clean and standard.






          share|improve this answer























          • erro: Route [cadastrar] not defined. But it's

            – Ermeson Oliveira
            Mar 24 at 18:43











          • Did you name the route in the web.php file?

            – GabMic
            Mar 24 at 18:48











          • Route::post('/cadastrar', 'UserController@cadastrar');

            – Ermeson Oliveira
            Mar 24 at 18:51











          • You haven't named it. Do it like so: Route::post('/cadastrar', 'UserController@cadastrar')->name('nameOfRoute');

            – GabMic
            Mar 24 at 19:19
















          0














          In your form, change the action to action="route('nameOfRoute')"



          And just name your route like usual.
          You can also make a Route::resource() to make things more clean and standard.






          share|improve this answer























          • erro: Route [cadastrar] not defined. But it's

            – Ermeson Oliveira
            Mar 24 at 18:43











          • Did you name the route in the web.php file?

            – GabMic
            Mar 24 at 18:48











          • Route::post('/cadastrar', 'UserController@cadastrar');

            – Ermeson Oliveira
            Mar 24 at 18:51











          • You haven't named it. Do it like so: Route::post('/cadastrar', 'UserController@cadastrar')->name('nameOfRoute');

            – GabMic
            Mar 24 at 19:19














          0












          0








          0







          In your form, change the action to action="route('nameOfRoute')"



          And just name your route like usual.
          You can also make a Route::resource() to make things more clean and standard.






          share|improve this answer













          In your form, change the action to action="route('nameOfRoute')"



          And just name your route like usual.
          You can also make a Route::resource() to make things more clean and standard.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 24 at 18:34









          GabMicGabMic

          869722




          869722












          • erro: Route [cadastrar] not defined. But it's

            – Ermeson Oliveira
            Mar 24 at 18:43











          • Did you name the route in the web.php file?

            – GabMic
            Mar 24 at 18:48











          • Route::post('/cadastrar', 'UserController@cadastrar');

            – Ermeson Oliveira
            Mar 24 at 18:51











          • You haven't named it. Do it like so: Route::post('/cadastrar', 'UserController@cadastrar')->name('nameOfRoute');

            – GabMic
            Mar 24 at 19:19


















          • erro: Route [cadastrar] not defined. But it's

            – Ermeson Oliveira
            Mar 24 at 18:43











          • Did you name the route in the web.php file?

            – GabMic
            Mar 24 at 18:48











          • Route::post('/cadastrar', 'UserController@cadastrar');

            – Ermeson Oliveira
            Mar 24 at 18:51











          • You haven't named it. Do it like so: Route::post('/cadastrar', 'UserController@cadastrar')->name('nameOfRoute');

            – GabMic
            Mar 24 at 19:19

















          erro: Route [cadastrar] not defined. But it's

          – Ermeson Oliveira
          Mar 24 at 18:43





          erro: Route [cadastrar] not defined. But it's

          – Ermeson Oliveira
          Mar 24 at 18:43













          Did you name the route in the web.php file?

          – GabMic
          Mar 24 at 18:48





          Did you name the route in the web.php file?

          – GabMic
          Mar 24 at 18:48













          Route::post('/cadastrar', 'UserController@cadastrar');

          – Ermeson Oliveira
          Mar 24 at 18:51





          Route::post('/cadastrar', 'UserController@cadastrar');

          – Ermeson Oliveira
          Mar 24 at 18:51













          You haven't named it. Do it like so: Route::post('/cadastrar', 'UserController@cadastrar')->name('nameOfRoute');

          – GabMic
          Mar 24 at 19:19






          You haven't named it. Do it like so: Route::post('/cadastrar', 'UserController@cadastrar')->name('nameOfRoute');

          – GabMic
          Mar 24 at 19:19




















          draft saved

          draft discarded
















































          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.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55327089%2fprotect-routes-in-laravel-when-manually-entered-address%23new-answer', 'question_page');

          );

          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







          Popular posts from this blog

          Obelisk of Theodosius Contents History Description Notes Bibliography Further reading External links Navigation menuAge of spirituality : late antique and early Christian art, third to seventh centuryOver 60 picturesObelisks of the World41°00′21.24″N 28°58′31.43″E / 41.0059000°N 28.9753972°E / 41.0059000; 28.97539727724550-7235741376235741376

          밀양 대씨 역사 각주 함께 보기 둘러보기 메뉴밀양 대씨

          1973년 목차 사건 문화 탄생 사망 노벨상 달력 둘러보기 메뉴