2 İşlemeler 973b4dfa31 ... 237ec573cf

Yazar SHA1 Mesaj Tarih
  socket_ 237ec573cf Merge branch 'master' of notabug.org:webProgrammingPeople/wroteit 3 yıl önce
  socket_ 99d1f28a10 final? 3 yıl önce
1 değiştirilmiş dosya ile 6 ekleme ve 3 silme
  1. 6 3
      app/Http/Controllers/PostController.php

+ 6 - 3
app/Http/Controllers/PostController.php

@@ -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;
 	}
 }