2

Route [settings] not defined. (View: C:\xampp\htdocs\laravel\UserManagementSystem\resources\views\layouts\app.blade.php)

I wanted to create a user profile updation. i created the blade fields and all necessary fields but when i run the program it shows the error

This is my web.php

<?php
Route::get('/', function () {
return view('welcome');
});

Auth::routes();

Route::get('/home', 'HomeController@index')->name('home');

Route::group( ['middleware' => ['auth']], function() {
Route::resource('users', 'UserController');

Route::resource('roles', 'RoleController');
Route::resource('posts', 'PostController');
Route::resource('settings', 'SettingsController');
});

And my app.blade.php is

<a href="{{ route('settings') }}"
onclick="event.preventDefault();                                                 
document.getElementById('settings-form').submit();">
<i class="glyphicon glyphicon-log-out"></i> Settings
</a>

<form id="settings-form" action="{{ route('settings') }}" method="POST" 
style="display: none;">
{{ csrf_field() }}
</form>

Any one please help me. I am stuck with my work

1

4 Answers 4

2

Change your route() method to url() like shown bellow.

<a href="{{ url('settings') }}"
onclick="event.preventDefault();                                                 
document.getElementById('settings-form').submit();">
<i class="glyphicon glyphicon-log-out"></i> Settings
</a>

<form id="settings-form" action="{{ url('settings') }}" method="POST" 
style="display: none;">
{{ csrf_field() }}
</form>

Sign up to request clarification or add additional context in comments.

Comments

2

use@storefor storing data in database

in .blade.php file

<form id="settings-form" action="{{ route('settings') }}" method="post">

@csrf </form>

In web.php

Route::post('settings', 'SettingsController@store')->name('settings');

1 Comment

Don´t forget to clear the route cache: php artisan route:cache
0

Try route('setting.{resource function-name}'); like route('setting.index)
or route('setting.show', ['id'=> 'setting_id']);

instead of just route('setting');

you are using a

Route::resource('settings', 'SettingsController');

you have to specify which function using in a resource route. If you want to know which function there are in your resource controller check out this link:

https://laravel.com/docs/5.7/controllers

Comments

0

try this:

Route::get('settings', 'SettingsController')->name('settings');

or

Route::resource('settings', 'SettingsController')->name('settings);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.