Jump to content

How to show post title instead of single.php/Id=3 in URL


Rasheed4u
Go to solution Solved by Rasheed4u,

Recommended Posts

And who or what is creating that url?  That would be nice to know if we are supposed to tell you how to alter it, don't you think?

Do we have to pull this info from you or are you going to get to the point and help us to help you?

PS - free hosting.  You get what you pay for.

Link to comment
Share on other sites

  • Solution

If you don't know anything kindly shut the fucck off. I explained that the free hosting was to verify issues before finally going live on premium. Stop being unnecessarily rude and condescending to strangers MF.

As for the question above, I have gotten a solution. Anyone with similar issue can use this code

// get all posts

$posts = Post::all(); 

 

// loop through all posts

foreach ($posts as $post) { 

  // convert the title into a slug and save it to the slug field  

  $post->slug = Str::slug($post->title); 

 

  // save the post  

  $post->save(); 

}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.