|
@@ -74,7 +74,7 @@ class PostController extends Controller
|
|
|
// get subwroteit and increment field posts_number by 1
|
|
|
//$this->store_relation_subtopicSubscriber($subtopic_name, $user_id);
|
|
|
//return redirect()->route('show_post',['sub' => $request->input('sub')],['post_id' => $post->post_id_string]);
|
|
|
- return redirect()->route('main');
|
|
|
+ return redirect()->route('show_post',['sub' => $request->input('sub'),'post_id' => $post->post_id_string]);
|
|
|
}
|
|
|
|
|
|
public function storeNewComment(NewCommentRequest $request){
|
|
@@ -100,17 +100,20 @@ class PostController extends Controller
|
|
|
}
|
|
|
|
|
|
public static function generateFancyPostID(string $sub,string $title){
|
|
|
- $vanilla=$title;
|
|
|
+ $title=$title . "-" . date("y-m-d-");
|
|
|
$number=0;
|
|
|
$foundFancy=false;
|
|
|
while(!$foundFancy){
|
|
|
- $number++;
|
|
|
$fancy=$title . $number;
|
|
|
$post = Post::where('subwroteit',$sub)->where('post_id_string',$fancy)->first();
|
|
|
if(is_null($post)){
|
|
|
$foundFancy=true;
|
|
|
}
|
|
|
+ else{
|
|
|
+ $number++;
|
|
|
+ }
|
|
|
}
|
|
|
+ $fancy=str_replace(" ","-",$fancy);
|
|
|
return $fancy;
|
|
|
}
|
|
|
}
|