Support the ongoing development of Laravel.io →
posted 10 years ago
Database

Hello,

Im using cviebrock/eloquent-sluggable and wanna make unique slug for news table. News model:

class News extends Eloquent implements SluggableInterface {

protected $table = 'news';
protected $fillable = ['title','content','image','slug'];
use SluggableTrait;

protected $sluggable = array(
    'build_from' => 'title',
    'save_to'    => 'slug',
);

}

Can i build slug from title and random string? How it looks like?

Last updated 2 years ago.
0
Route::get('/news/post/{title}/{other_random_string}', NewsController@handlePostCreate);

//Controller
NewsController extends BaseController
{
    public function handlePostCreate(title, other_random_string)
    {
         var_dump($title);
         var_dump($other_random_string);
    }
}
Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

MantasIT mantasit Joined 17 Nov 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.