B
B
bpGusar2017-08-19 21:15:11
Laravel
bpGusar, 2017-08-19 21:15:11

Error Action App\Http\Controllers\[email protected]_name not defined. Why does it occur?

Route

Route::get('admin/students', '[email protected]_avatar');

Controller
public function update_avatar()
    {

    }
// ну тут просто объявленная функция

view
<a href="{{action('[email protected]_avatar')}}">Link name/Embedded Button</a>

It gives an error Action App\Http\Controllers\[email protected]_avatar not defined
I don't understand what's wrong.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Novikov, 2017-08-21
@bpGusar

First:
Functions are called through camelCase with a small bull, and variables through snack_case (PSR-2).
Secondly:
Route can be called in a bunch of ways:
one.

<a href="{{ route('updateAvatar') }}">Link name/Embedded Button</a></li>

2.
<a href="{{ action('[email protected]') }}">Link name/Embedded Button</a>
- If you have
FrontEndController
is in namespace
App\Http\Controllers

3.
<a href="{{ url('admin/students'') }}">Link name/Embedded Button</a></li>

4.
<a href="/admin/students'">Link name/Embedded Button</a></li>

K
Konstantin B., 2017-08-19
@Kostik_1993

so FrontEndController or all the same StudentsController?
In the route one thing, in the link another. Look somewhere they wrote something wrong

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question