Created
June 7, 2020 10:55
-
-
Save rakibdevs/d94f9f93b030a96beb28e67533924f72 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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