Answer the question
In order to leave comments, you need to log in
How to check if a URL is valid in Laravel?
How can I check if the url is valid?
public function addResource(Request $request)
{
$url = $request->post('url');
$result = $this->service->saveContent($url);
if ($result !== null) {
return response()->json(['status' => 'ok', 'message' => 'Url has been added', 'data' => $result]);
}
return response()->json(['status' => 'error', 'message' => 'Error', 'data' => ['url' => $url]]);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question