get(); foreach($aps as $ap) { $photo = DB::table("photos")->where("id", $ap->photo_id)->first(); DB::table("album_photo")->where("id", $ap->id)->update([ "created_at" => $photo->created_at ]); } } /** * Reverse the migrations. */ public function down(): void { // } };