コード例 #1
0
ファイル: DatabaseSeeder.php プロジェクト: yves01/dashboard
 public function run()
 {
     Model::unguard();
     DB::table('conversations')->delete();
     for ($i = 0; $i < 80; $i++) {
         $request = new CreateConversationRequest();
         $request->Title = "Conversation {$i} level contain title";
         $request->Content = "Thread from conversation {$i}";
         $request->Pending = false;
         Conversation::customCreate($request);
     }
     /* roughly equivalent to the following instructions without selection the first user available
     		// Take the first ID in the table
     		$user=User::first()->id;
     		// We create the conversation
     		$aConv=Conversation::create(['Title'=> "Demonstration: Conversation level contain title",
     							  'user_id'=> $user,
     							  'Pending'=>false]);
     							  
     		// We create the first Thread of the Conversation		
     		Thread::create(['Content'=> "Demonstration: Thread level contain content",
     							  'user_id'=> $user,
     							  'Pending'=>false,
     							  'conversation_id'=>$aConv->id]);
     		*/
 }