git reset branch
git fetch origin
git reset --hard origin/branch_name
git reset branch
git fetch origin
git reset --hard origin/branch_name
laravel slug
$ composer require cviebrock/eloquent-sluggable
generate slug on create laravel
/**
* Laravel provides a boot method which is 'a convenient place to
* register your event bindings.'
* See: https://laravel.com/docs/master/eloquent#events
*/
public static function boot()
{
parent::boot();
// registering a callback to be executed upon the creation of an activity AR
static::creating(function($activity) {
// produce a slug based on the activity title
$slug = \Str::slug($news->title);
// check to see if any other slugs exist that are the same & count them
$count = static::whereRaw("slug RLIKE '^{$slug}(-[0-9]+)?$'")->count();
// if other slugs exist that are the same, append the count to the slug
$activity->slug = $count ? "{$slug}-{$count}" : $slug;
});
}
// Use the create method
Activity::create(['title'=>'lorem ipsum']);
laravel slug
php artisan vendor:publish --provider="Cviebrock\EloquentSluggable\ServiceProvider"
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us