user8808874
user8808874

Reputation:

Use of undefined constant id - assumed 'id' in laravel 5.4

What is this error?

Use of undefined constant id - assumed 'id'

public function update(Request $request)
{
    SubmitApplication::where('id', $request->get(id))->update(['approved' => true]);
    return redirect()->back();
}

Upvotes: -1

Views: 2071

Answers (1)

jedrzej.kurylo
jedrzej.kurylo

Reputation: 40919

Strings need to be wrapped in quotes, otherwise PHP assumes it's a name of a constant, hence the error.

Replace

$request->get(id)

with

$request->get('id')

Upvotes: 1

Related Questions