K
K
kaxa32012019-01-06 21:15:11
Laravel
kaxa3201, 2019-01-06 21:15:11

Why doesn't it find the validate method?

namespace App\Http\Controllers;
use Illuminate\Http\Request;

class ContentController extends Controller
{
public function addResource(Request $request)
    {

        $url = $request->validate($request, [
            'url'  => 'required|url',
        ]);
}}

Why doesn't it find Method 'validate' not found

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jazzus, 2019-01-07
@jazzus

Try adding additional use App\Http\Requests;
And it’s better to validate with a separate request file so that the code is not duplicated later

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question