Remove HTTP://, www and slashes from the URL
Below the PHP function removes HTTP, www and slashes. Use preg_replace
<?php
// Remove http://
$input = "http://codeweb.wall-spot.com";
$input = preg_replace( "#^[^:/.]*[:/]+#i", "",
$input );
/* Output codeweb.wall-spot.com */
echo $input;
?>
Credit: Remove PHP HTTP://, www and slashes from URL
How to remove HTTP:// or HTTPS:// from the URL and save to database in Laravel
The above method will do the same as this one. preg_replace
will replace the word with your words.
Use any of these
$url = preg_replace( "#^[^:/.]*[:/]+#i", "", $url );
or
$url = preg_replace("(^https?://)", "", $url);
public function removeurl()
{
$url = request('url');
$url = preg_replace("(^https?://)", "", $url);
$post->url = $url;
$post->save();
}