Skip to content

Instantly share code, notes, and snippets.

@rakibdevs
Created June 7, 2020 10:55
Show Gist options
  • Save rakibdevs/d94f9f93b030a96beb28e67533924f72 to your computer and use it in GitHub Desktop.
Save rakibdevs/d94f9f93b030a96beb28e67533924f72 to your computer and use it in GitHub Desktop.
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use App\Post;
class PostController extends Controller
{
//..............................
public function store(Request $request)
{
//..............................
$post = new Post();
//..............................
/* unique slug example
* my name is khan => my-name-is-khan
*/
$post->slug = $post->slugify($request->title); // unique slug generator
//..............................
$post->save();
//..............................
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment